Skip to content

Commit 74b8e6a

Browse files
committed
Re-enable autoruns for cmd.exe on Windows
This acts as a revert of b83747a and 9886744. As pointed out by Noah, HEAD and REL_17_STABLE are in a weird state where the code paths adding /D would limit the spawn of child processes, but we still have code paths where the spawn of more than one child process(es) would be possible. Let's remove these /D switches for now, to bring back the code into a state consistent with how autorun is configured on a Windows host. Reported-by: Noah Misch Discussion: https://postgr.es/m/20240630021211.f3.nmisch@google.com Backpatch-through: 17
1 parent 066e8ac commit 74b8e6a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/bin/pg_ctl/pg_ctl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,11 +552,11 @@ start_postmaster(void)
552552
else
553553
close(fd);
554554

555-
cmd = psprintf("\"%s\" /D /C \"\"%s\" %s%s < \"%s\" >> \"%s\" 2>&1\"",
555+
cmd = psprintf("\"%s\" /C \"\"%s\" %s%s < \"%s\" >> \"%s\" 2>&1\"",
556556
comspec, exec_path, pgdata_opt, post_opts, DEVNULL, log_file);
557557
}
558558
else
559-
cmd = psprintf("\"%s\" /D /C \"\"%s\" %s%s < \"%s\" 2>&1\"",
559+
cmd = psprintf("\"%s\" /C \"\"%s\" %s%s < \"%s\" 2>&1\"",
560560
comspec, exec_path, pgdata_opt, post_opts, DEVNULL);
561561

562562
if (!CreateRestrictedProcess(cmd, &pi, false))

src/test/regress/pg_regress.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1244,7 +1244,7 @@ spawn_process(const char *cmdline)
12441244
comspec = "CMD";
12451245

12461246
memset(&pi, 0, sizeof(pi));
1247-
cmdline2 = psprintf("\"%s\" /d /c \"%s\"", comspec, cmdline);
1247+
cmdline2 = psprintf("\"%s\" /c \"%s\"", comspec, cmdline);
12481248

12491249
if (!CreateRestrictedProcess(cmdline2, &pi))
12501250
exit(2);

0 commit comments

Comments
 (0)