spawn with CREATE_NO_WINDOW on Windows#66
Merged
Conversation
samclark2015
approved these changes
Jun 9, 2026
samclark2015
left a comment
There was a problem hiding this comment.
Tested this on my Windows VM. Did not encounter any issues, but notably was not able to test in the RDP setup described in the issue.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem
On Windows, R sessions fail to start with exit code
0xC0000142(STATUS_DLL_INIT_FAILED) after Positron is closed and reopened against an already-running supervisor.The supervisor is normally launched inside a terminal whose pseudoconsole (conpty) is owned by Positron. When Positron exits, that pseudoconsole is destroyed. In setups where the supervisor outlives Positron (e.g. it gets orphaned instead of cleaned up, which we've seen on Windows Server / Remote Desktop installs), the supervisor is left holding a dead console handle. Kernels spawned afterwards inherited that dead console and died during process initialization, before producing any output, so the user just saw the session fail to start.
Change
On Windows, kernel processes are now spawned with the
CREATE_NO_WINDOWflag, giving each kernel its own hidden console instead of inheriting the supervisor's. This isolates kernels from the supervisor's console lifetime, so they start cleanly even when the supervisor's original console is gone.We also use a job object to replace the former implicit termination that happened when R/Python inherited the console of the supervisor.
Notes
This addresses the spawn-side failure. It does not change the separate question of why the supervisor is sometimes left running after Positron exits.
Discovered while investigating posit-dev/positron#13951, but doesn't necessarily close the issue.