1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

remove 2nd attempt at invoking ComSpec when spawning child

The start_child procedure is used to spawn a child process. If it fails
to launch the given argv[0] as if it were a command, it has logic to
retry using the ComSpec as a command interpreter, treating argv[0] as
a batch file name. Usually, this fails because batch files would have
been handled in the first pass if they were valid.  Also, this has
the unfortunate side effect of spawning a shell awaiting user input.

It is safer to remove this attempt.

* libguile/posix-w32.c (start_child): remove fallback processing
This commit is contained in:
Michael Gran 2021-01-22 20:49:04 -08:00
parent 653cc0bf95
commit 1b697d339b

View file

@ -1,4 +1,4 @@
/* Copyright 2001,2006,2008,2016,2018
/* Copyright 2001,2006,2008,2016,2018,2021
Free Software Foundation, Inc.
This file is part of Guile.
@ -740,22 +740,6 @@ 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)
{
const char *shell = getenv ("ComSpec");
if (!shell)
shell = "cmd.exe";
if (c_strcasecmp (exec_file, shell) != 0)
{
argv[0] = (char *)exec_file;
return start_child (shell, argv, reading, c2p, writing, p2c,
infd, outfd, errfd);
}
}
errno = errno_save;
return pid;
}