Description
On Windows, when openapi-changes is launched as a subprocess with no console window, the process hangs indefinitely. This affects any command, including a bare openapi-changes invocation with no arguments.
Launching subprocesses with no console window is common when running from GUI applications, background services, CI agents, or tools that orchestrate multiple CLI processes without flashing console windows.
This is Windows-specific. SysProcAttr.CreationFlags only exists in Windows-specific source files, so the repro code won't compile on other platforms. In .NET, CreateNoWindow compiles on all platforms but has no effect on macOS or Linux.
Reproduction
package main
import (
"os"
"os/exec"
"syscall"
)
func main() {
cmd := exec.Command("openapi-changes")
cmd.SysProcAttr = &syscall.SysProcAttr{
CreationFlags: 0x08000000, // CREATE_NO_WINDOW
}
cmd.Stdout = os.Stdout
err := cmd.Run() // hangs indefinitely
if err != nil {
panic(err)
}
}
The equivalent in .NET (where this was originally discovered). In .NET, both CreateNoWindow and RedirectStandardInput must be true to trigger the hang (when RedirectStandardInput is false, the child inherits the parent's stdin handle rather than getting a pipe):
using System.Diagnostics;
using var process = new Process();
process.StartInfo.FileName = "openapi-changes";
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardInput = true;
process.StartInfo.CreateNoWindow = true;
process.Start();
process.WaitForExit(); // hangs indefinitely
Expected Behaviour
The process runs to completion and exits.
Actual Behaviour
The process hangs indefinitely and never exits.
Workaround
Set PB33F_DARK_BACKGROUND=1 (or 0 for light).
Environment
- openapi-changes v0.2.6
- Windows (the
CREATE_NO_WINDOW flag is Windows-specific)
Context
Found while investigating adamralph/simple-exec#843
Description
On Windows, when
openapi-changesis launched as a subprocess with no console window, the process hangs indefinitely. This affects any command, including a bareopenapi-changesinvocation with no arguments.Launching subprocesses with no console window is common when running from GUI applications, background services, CI agents, or tools that orchestrate multiple CLI processes without flashing console windows.
This is Windows-specific.
SysProcAttr.CreationFlagsonly exists in Windows-specific source files, so the repro code won't compile on other platforms. In .NET,CreateNoWindowcompiles on all platforms but has no effect on macOS or Linux.Reproduction
The equivalent in .NET (where this was originally discovered). In .NET, both
CreateNoWindowandRedirectStandardInputmust betrueto trigger the hang (whenRedirectStandardInputisfalse, the child inherits the parent's stdin handle rather than getting a pipe):Expected Behaviour
The process runs to completion and exits.
Actual Behaviour
The process hangs indefinitely and never exits.
Workaround
Set
PB33F_DARK_BACKGROUND=1(or0for light).Environment
CREATE_NO_WINDOWflag is Windows-specific)Context
Found while investigating adamralph/simple-exec#843