@@ -85,13 +85,21 @@ trap cleanup EXIT
8585# Use a long-running stdin feeder as a SEPARATE backgrounded process, then
8686# connect it to the server via a named pipe (FIFO) to avoid bash subshell
8787# PID issues with `A | B &`.
88- FIFO=" $( mktemp -u) "
89- mkfifo " ${FIFO} " 2> /dev/null || {
90- # mkfifo may not exist on Windows Git Bash — fall back to /dev/null stdin.
91- # The server will exit immediately on EOF but we can still check if startup
92- # succeeds before the transport closes.
93- FIFO=" "
94- }
88+ #
89+ # On Windows (MSYS2/Git Bash), mkfifo creates MSYS2-specific named pipes
90+ # that native Windows processes (node.exe) cannot read from reliably.
91+ # Force the process-substitution fallback on Windows, which creates a
92+ # Windows-compatible pipe handle that node.exe can read from correctly.
93+ FIFO=" "
94+ case " $( uname -s) " in
95+ MINGW* |MSYS* |CYGWIN* )
96+ # Windows: skip mkfifo — native node.exe cannot read from MSYS2 FIFOs.
97+ ;;
98+ * )
99+ FIFO=" $( mktemp -u) "
100+ mkfifo " ${FIFO} " 2> /dev/null || { FIFO=" " ; }
101+ ;;
102+ esac
95103
96104if [[ -n " ${FIFO} " ]]; then
97105 # Feed the FIFO in the background so the server's stdin stays open
@@ -101,7 +109,9 @@ if [[ -n "${FIFO}" ]]; then
101109 node " ${SERVER_BUNDLE} " < " ${FIFO} " > /dev/null 2> " ${STDERR_FILE} " &
102110 SERVER_PID=$!
103111else
104- # Fallback: use process substitution to keep stdin open
112+ # Fallback: use process substitution to keep stdin open.
113+ # On Windows, Git Bash converts process substitution into a Windows
114+ # pipe handle that node.exe (native process) can read correctly.
105115 node " ${SERVER_BUNDLE} " < <( sleep 30) > /dev/null 2> " ${STDERR_FILE} " &
106116 SERVER_PID=$!
107117fi
@@ -140,9 +150,9 @@ if kill -0 "${SERVER_PID}" 2>/dev/null; then
140150else
141151 wait " ${SERVER_PID} " 2> /dev/null && EXIT_CODE=0 || EXIT_CODE=$?
142152
143- # On Windows, mkfifo is unavailable and the process-substitution fallback
144- # may not keep stdin open reliably. When the STDIO transport receives EOF
145- # the server shuts down cleanly (exit 0) even though startup succeeded.
153+ # On Windows, process substitution may not keep stdin open reliably.
154+ # When the STDIO transport receives EOF the server shuts down cleanly
155+ # (exit 0) even though startup succeeded.
146156 # Accept that as a pass when the logs prove the server started correctly.
147157 if [[ " ${EXIT_CODE} " -eq 0 ]] && check_startup_logs; then
148158 echo " "
0 commit comments