1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-07-05 01:00:21 +02:00

In win32, system* shouldn't launch shell when command not found

When system* was called to execute a script/excutable without args, if
that did not exist, it would launch an interactive session. Now it fails
with an error.

* libguile/posix-w32.c (start_child): return when cmd not found
* test-suite/tests/posix.test (system*): system* test should handle errors
This commit is contained in:
Michael Gran 2018-04-19 13:21:47 -07:00
parent 98f4024e0a
commit b2a50874bb
2 changed files with 17 additions and 9 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2001, 2006, 2008, 2016 Free Software Foundation, Inc.
/* Copyright (C) 2001, 2006, 2008, 2016, 2018 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@ -740,8 +740,11 @@ start_child (const char *exec_file, char **argv,
CloseHandle (herr);
CloseHandle (pi.hThread);
/* Posix requires to call the shell if execvp fails to invoke EXEC_FILE. */
if (errno_save == ENOEXEC || errno_save == ENOENT)
/* Posix requires to call the shell if execvp fails to invoke EXEC_FILE.
* But if there are no arguments, this would just open an interactive
* cmd.exe shell, so return in that case. */
if ((errno_save == ENOEXEC || errno_save == ENOENT)
&& (argv[0] != NULL && argv[1] != NULL)
{
const char *shell = getenv ("ComSpec");