Say when windowsHide is the wrong flag, and hold main.js to it - #224
Merged
Conversation
The review standard stated the flag flatly — "windowsHide: true keeps console windows from flashing" — which is true for a console child and misleading for a GUI one. That gap is what produced #181: the editor spawn carried the flag, the editor honored the "start hidden" it puts in STARTUPINFO, and it launched with no window while the spawn still reported success. As written the rule would hand the same advice to the next GUI process someone spawns, so it now turns on the child's subsystem rather than on whether anyone reads its output — which also keeps it from reading as a complaint about taskkill in src/kill-tree.js. The other half of the same question is who may apply the patch in src/hide-child-windows.js. Today only the four runners call it and main.js never does, but nothing said so and nothing checked. A plausible change — hide the console flashes everywhere, once at startup — would reinstate #181 in silence: test/editor-launch.test.cjs injects its own spawn and never sees the real module, and test/runner-wiring.test.cjs only asserts that the runners do call it. So the module header now names who must not call it, and test/ipc-wiring.test.cjs asserts main.js does not, at load — which is where "once at startup" lands. The assertion watches for a call rather than reading the flag off the real child_process, because patchChildProcess is a no-op off Windows and that version would stay green on macOS whatever main.js did. Fixes #202 Fixes #203 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (1)
.github/instructions/code-review.instructions.md:206
- The phrase “turns on the child's subsystem” reads like
windowsHidechanges the PE subsystem of the spawned binary, which it can’t; the actual point is that the flag’s effect depends on whether the child is a console vs GUI app. Rewording this sentence would avoid confusing future readers.
**`windowsHide: true` turns on the child's subsystem, not on whether anyone reads its output.**
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #202. Closes #203.
Two halves of the same question, so one PR.
The rule was written for one kind of child
The Windows section of the review standard said the flag flatly:
True for a console child, misleading for a GUI one — and that gap is what produced #181. The editor spawn carried the flag, the editor honored the "start hidden" it puts in STARTUPINFO, and it launched with no window while the spawn still reported success. Left as it was, the rule hands the same advice to the next GUI process someone spawns.
It now turns on the child's subsystem rather than on whether anyone reads the child's output. That distinction matters for more than the editor:
src/kill-tree.jssets the flag ontaskkill, whose output nobody reads, and an "only if you read its output" rule would have made that line look wrong.Nothing stopped main from applying the patch
patchChildProcessis deliberately blunt — everychild_processentry point, overriding even an explicitwindowsHide: false. That is safe today only because the four runners call it andmain.jsdoes not, which nothing said and nothing checked."Hide the console flashes everywhere, do it once at startup" is the plausible-looking change that reinstates #181 in silence.
test/editor-launch.test.cjsinjects its ownspawn, so it never sees the real module;test/runner-wiring.test.cjsonly asserts that the runners do call it.So the module header now names who must not call it, and
test/ipc-wiring.test.cjsassertsmain.jsdoes not.On the test
It watches for a call that does not happen rather than reading the flag off the real
child_process.patchChildProcessis a no-op off Windows, so the flag-reading version would be green on macOS whatevermain.jsdid — the "green while proving nothing" shape the standard already names.Scoped to module evaluation, which is where "once at startup" lands. A call made lazily inside a handler would slip past it; that is a less likely shape, and the module header carries the rule for it.
Testing
npm test— 610 pass, 0 fail.npm run lint— clean.require('./hide-child-windows').hideChildWindows();tosrc/main.jsfails the new test, and only that test.🤖 Generated with Claude Code