[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: system* always returns #f on W2K
Hannu Koivisto <azure@iki.fi> writes:
| It seems that system* always returns #f on at least Windows 2000
...
| would be welcome (I try to take a look at the source code myself
So, I took a look at the source code with a colleague of mine who
is a Windows user and after little testing and printf-debugging we
noticed that system* doesn't even wait for the process to finish.
This seems to be because in code...
spawn_status = MSC_IZE(spawnv)(type, command, (const char * const *)argv);
if (!synchonous) {
/* Restore stdin and stdout */
MSC_IZE(dup2)(save0, 0);
MSC_IZE(dup2)(save1, 1);
MSC_IZE(dup2)(save2, 2);
pid = spawn_status;
if (spawn_status != -1)
sc = (void *)pid;
} else if ((spawn_status != -1) && !as_child) {
sc = (void *)spawn_status;
scheme_block_until(subp_done, subp_needs_wakeup, (void *)sc, (float)0.0);
#ifdef WINDOWS_PROCESSES
{
DWORD w;
if (GetExitCodeProcess((HANDLE)sc, &w))
spawn_status = w;
else
spawn_status = -1;
}
#endif
#ifdef BEOS_PROCESSES
spawn_status = (((BeOSProcess *)sc)->result ? -1 : 0);
#endif
pid = 0;
}
...from process function in port.c neither of if branches is
entered because as_child is true (1). We'd also like to point out
that the wait function corresponding to the spawnv (I'm didn't
check what scheme_block_until actually uses) returns the exit code
of the process and calling GetExitCodeProcess is somewhat
questionable, if you want to read documentation literally, because
we couldn't find anyone guaranteeing that the process handle is
actually a Win32 process handle. I'm sure it actually is a Win32
process handle and thus that should work, though.
--
Hannu