From 922b18888a177879df1569d1969abfcaa0090a6f Mon Sep 17 00:00:00 2001 From: Gurusamy Sarathy Date: Thu, 17 Aug 2000 00:19:20 +0000 Subject: 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 --- pp_sys.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'pp_sys.c') 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; } -- cgit v1.2.1