On 1/18/23 7:42 AM, Tobias Burnus wrote:
Reported by nightstrike, who also tested this patch.

On Windows, we call system() which works as described at
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/system-wsystem?view=msvc-170

Namely, it only fails with "-1" if the command interpreter
could not be started. Otherwise, it has the return value.
(Same on Linux.) On POSIX systems, 'sh' calls exit(127) or
_exit(127) if it cannot execute the program of the passed string,
as documented. Cf. https://www.unix.com/man-page/posix/3p/system/

Thus, the question is what happens on Windows. Our experiments, several
webpages (like stackoverflow) and the source code of WINE for cmd.exe indicate
that Windows returns 9009 in that case. See for instance
https://github.com/wine-mirror/wine/blob/master/programs/cmd/wcmdmain.c#L1262-L1269

Thus, we now do likewise. The code is for MINGW; Cygwin does not set that that
var and is likely to use return values closer to POSIX.

OK for mainline?

Tobias

OK, thanks fir fix.

Jerry

Reply via email to