Try to rescue users in one simple case

This commit is contained in:
dmiller 2026-02-16 18:40:19 +00:00
parent 92224d5470
commit 52508f77bb

View file

@ -191,6 +191,7 @@ static int run_command_redirected(char *cmdexec, struct subprocess_info *info)
SECURITY_ATTRIBUTES sa;
STARTUPINFO si;
PROCESS_INFORMATION pi;
char *app_name = NULL;
setup_environment(&info->fdn);
@ -248,7 +249,18 @@ static int run_command_redirected(char *cmdexec, struct subprocess_info *info)
memset(&pi, 0, sizeof(pi));
if (CreateProcess(NULL, cmdexec, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi) == 0) {
/* The user ought to quote the binary name if it contains spaces, but they
* might not. If it's not quoted, we'll try to help them out. */
if (cmdexec[0] != '"') {
DWORD dwType = 0;
/* Check if the whole command is just the name of an executable file. */
if (GetBinaryType(cmdexec, &dwType)) {
/* If so, pass this to CreateProcess to avoid space-splitting */
app_name = cmdexec;
}
}
if (CreateProcess(app_name, cmdexec, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi) == 0) {
if (o.verbose) {
LPVOID lpMsgBuf;
FormatMessage(