-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure node-based debug adapters spawn same node exec as Theia #5492
Closed
Closed
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5c7fbc8
Ensure node-based debug adapter spawn same node as Theia
perspectivus1 ff1f50f
Merge https://github.com/theia-ide/theia
perspectivus1 3d01560
Fixed spawning debug processes in Electron
perspectivus1 f8d930a
Spawn Node.js-based debug adapter using Electron's embedded Node.js
perspectivus1 452ec24
removing use of runAsNodeEnv(), as we always spawn debug adapters (an…
perspectivus1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kittaakos, is this what you meant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks much better now, logically it is correct.
Can we move this Node.js-specific customization to the process-factory?
What's your take on that, @akosyakov?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why
execPath
is used only inelse
branch.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean if
command
===process.execPath
? fornode
i don't think so, it is not the sameI don't think this code should use process factory at all, but it is another issue. User processes (running in user dev env like terminals and task) should be created by a factory, all other should be created vis node js APIs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, should I move the implementation elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if it is true. But please correct me if I am wrong.
If I have Node.js
v10.15.3
available from thePATH
and I start a Theia-based electron application which comes with electron3.1.7
(as of today), then I will run with a different Node.js version than I am expecting.Does this make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is not true, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When Theia runs in node, we can control the node executable that is used to spawn the debug adapter, because we can infer it from
process.execPath
.When Theia runs in Electron,
process.execPath
contains a full path to the electron executable. Therefore, we have 2 choices:PATH
environment variable.ELECTRON_RUN_AS_NODE
environment variable, which will use Electron's embedded node.However, the current implementation of
AbstractVSCodeDebugAdapterContribution.provideDebugAdapterExecutable()
creates aDebugAdapterExecutable
that causes Theia to spawn, rather than fork debug adapters.In other words, in the case of a node-based debug adapter, the code above always spawn a node process, regardless of whether Theia runs in Electron or in node and regardless of the value of the
ELECTRON_RUN_AS_NODE
environment variable.If this is the desired behavior, then this PR fulfills the requirement.
If we wish to use Electron's embedded node, I will have to modify PR #5508.
Please advise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forking is a proper solution. It is the same way as VS Code does it. I would be in favor of closing this PR and modifying #5508.