2 # Copyright (C) 2001-2005, The Perl Foundation.
7 use lib qw( . lib ../lib ../../lib );
9 use Parrot::Test tests => 7;
13 t/op/spawnw.t - Run OS commands and tell about the exit code
21 Tests spawning external commands.
23 spawnw does not capture STDOUT and STDERR from the spawned command.
24 So only the exit code can be tested.
26 The returned value is actually returned from the 'waitpid' system call.
27 In order to get the exit code from the spawned process, it needs to be right
32 Test negative return codes.
36 The special variable $? in Perl5.
40 Nigel Sandever - L<nigelsandever@btconnect.com>
44 # perl command coded this way to avoid platform
47 # test string version of spawnw
49 pasm_output_is( <<'CODE', <<'OUTPUT', "exit code: 0" );
50 set S1, 'perl -e "exit(0)"'
62 pasm_output_is( <<'CODE', <<'OUTPUT', "exit code: 123" );
63 set S1, 'perl -e "exit(123)"'
75 pasm_output_is( <<'CODE', <<'OUTPUT', "exit code: 3" );
76 set S1, 'perl -e "exit(3)"'
88 # test array version of spawnw
90 pasm_output_is( <<'CODE', <<'OUTPUT', "exit code: 0" );
107 pasm_output_is( <<'CODE', <<'OUTPUT', "exit code: 123" );
112 set P0[2], "exit(123)"
116 print "return code: "
124 pasm_output_is( <<'CODE', <<'OUTPUT', "exit code: 3" );
133 print "return code: "
141 pir_output_is( <<'CODE', <<'OUTPUT', "grow argv buffer" );
145 $S0 = "exit length(qq{"
148 if $I0 >= 1000 goto end
149 $S0 = concat $S0, "A"
153 $S0 = concat $S0, "}) / 100"
154 new args, 'ResizablePMCArray'
160 print "return code: "
171 # cperl-indent-level: 4
174 # vim: expandtab shiftwidth=4: