summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-08-17 00:19:20 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-08-17 00:19:20 +0000
commit922b18888a177879df1569d1969abfcaa0090a6f (patch)
tree4385d58bf1179ca62684b41fbc028e6b3bc35d48 /pp_sys.c
parent8af02333c93343b2ed2e522e4fa455023e6cc339 (diff)
downloadperl-922b18888a177879df1569d1969abfcaa0090a6f.tar.gz
waitpid() now handles externally spawned pids correctly;
fixes for backtick/wait/waitpid failures on Windows 9x these changes make the pid returned by process functions on Windows 9x always positive by clearing the high bit (which is always set on Win9x); pseudo-process PIDs are likewise always negative now on Win9x (just as on NT/2000) p4raw-id: //depot/perl@6661
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/pp_sys.c b/pp_sys.c
index ba9e3bf5d7..8a77c09d35 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -3868,6 +3868,8 @@ PP(pp_system)
}
PerlProc__exit(-1);
#else /* ! FORK or VMS or OS/2 */
+ PL_statusvalue = 0;
+ result = 0;
if (PL_op->op_flags & OPf_STACKED) {
SV *really = *++MARK;
value = (I32)do_aspawn(really, (void **)MARK, (void **)SP);
@@ -3877,10 +3879,12 @@ PP(pp_system)
else {
value = (I32)do_spawn(SvPVx(sv_mortalcopy(*SP), n_a));
}
+ if (PL_statusvalue == -1) /* hint that value must be returned as is */
+ result = 1;
STATUS_NATIVE_SET(value);
do_execfree();
SP = ORIGMARK;
- PUSHi(STATUS_CURRENT);
+ PUSHi(result ? value : STATUS_CURRENT);
#endif /* !FORK or VMS */
RETURN;
}