[MSWin32] t/op/spawnw.t

0 views
Skip to first unread message

Ron Blaschke

unread,
Mar 30, 2005, 1:19:52 PM3/30/05
to perl6-i...@perl.org
F<t/op/spawnw.t> currently fails on Windows. The reason is that the
test expects the exit code in the higher byte of the termination
status. In other words:
set S1, 'perl -e "exit(123)"'
set I1, 99
spawnw I1, S1
shr I2, I1, 8
print "return code: "
print I2
print "\n"
end

On Windows, it is returned as-is, thus it should read:
set S1, 'perl -e "exit(123)"'
set I1, 99
spawnw I1, S1
print "return code: "
print I1
print "\n"
end

The documentation for spawnw (F<ops/sys.ops>) says:
Spawn a subprocess and wait for it to finish. The return status,
which is very system-dependent, goes in $1.

Thus, I guess the place to change is F<t/ops/spawnw.t>. Should I skip
the original tests on Windows, and add Windows specific ones (that are
run only there)?

Ron


Leopold Toetsch

unread,
Apr 2, 2005, 5:05:56 AM4/2/05
to Ron Blaschke, perl6-i...@perl.org, ch...@pobox.com
Ron Blaschke <mailin...@rblasch.org> wrote:
> F<t/op/spawnw.t> currently fails on Windows. The reason is that the
> test expects the exit code in the higher byte of the termination
> status.

[ code snippet ]

> The documentation for spawnw (F<ops/sys.ops>) says:
> Spawn a subprocess and wait for it to finish. The return status,
> which is very system-dependent, goes in $1.

Yeah. What does Perl5?

> Thus, I guess the place to change is F<t/ops/spawnw.t>. Should I skip
> the original tests on Windows, and add Windows specific ones (that are
> run only there)?

Or provide a more unified view of the result?

> Ron

leo

Ron Blaschke

unread,
Apr 2, 2005, 5:44:07 AM4/2/05
to Chip Salzenberg, Leopold Toetsch, perl6-i...@perl.org
Leopold Toetsch wrote:

> Ron Blaschke <mailin...@rblasch.org> wrote:
>> The documentation for spawnw (F<ops/sys.ops>) says:
>> Spawn a subprocess and wait for it to finish. The return status,
>> which is very system-dependent, goes in $1.
> Yeah. What does Perl5?

$?
"This is just the 16-bit status word returned by the wait() system call
(or else is made up to look like it)."

>> Thus, I guess the place to change is F<t/ops/spawnw.t>. Should I skip
>> the original tests on Windows, and add Windows specific ones (that are
>> run only there)?

> Or provide a more unified view of the result?

That's what I am thinking. I'd even return something more structured
than a "16-bit status word," with
"the exit value of the subprocess is really ("$? >> 8"), and "$? &
127" gives which signal, if any, the process died from, and "$? & 128"
reports whether there was a core dump."

The platform specific implementations seem to be the best place to
handle _all_ platform differences, including input parameter,
execution, and return values.

Ron

Reply all
Reply to author
Forward
0 new messages