Skip to content

Clear out hijackable options in darwin/bin/code.sh#204396

Closed
forivall wants to merge 1 commit intomicrosoft:mainfrom
forivall:patch-1
Closed

Clear out hijackable options in darwin/bin/code.sh#204396
forivall wants to merge 1 commit intomicrosoft:mainfrom
forivall:patch-1

Conversation

@forivall
Copy link
Contributor

@forivall forivall commented Feb 5, 2024

Fixes #204005

Electron will log a warning when it is launched with these options, see electron/electron#40770 for more context.

Fixes microsoft#204005

Electron will log a warning when it is launched with these options, see electron/electron#40770 for more context.
@deepak1556
Copy link
Collaborator

Thanks the change makes sense, but we also need an update to Electron v27.3.1 for the fix to be complete. I will merge this PR after the version update.

@deepak1556 deepak1556 added this to the February 2024 milestone Feb 6, 2024
@deepak1556
Copy link
Collaborator

Actually this just workarounds the issue, we should be able to allow these variables in the integrated terminal when launching the application from terminal. This needs change in this runtime maybe a cli flag.

Thanks for the PR, closing as this is not the best way forward for the linked issue.

@deepak1556 deepak1556 closed this Feb 6, 2024
@forivall
Copy link
Contributor Author

forivall commented Feb 8, 2024

The environment variables inside of vscode are retrieved by launching a shell process internally and then reading the environment variables from it.

This is just for the cli wrapper script, which most of the time, the launched process just connects to the existing editor process over IPC and doesn't modify the environment of the running code process. Please correct me if vscode does make use of the environment variables on first launch or in the IPC case. In that situation, I can think of a few more solutions.

@deepak1556
Copy link
Collaborator

The change won't affect the shell process as you mentioned but it will affect the integrated terminal since the terminal agent is a forked child process and it will inherit the unset changes. To confirm, make the changes in this PR to script/code-cli.sh and try the following

> export NODE_OPTIONS="test"
> ./script/code-cli.sh
> `Terminal: Create New Terminal` in the application
> echo $NODE_OPTIONS // in the integrated terminal and it will be empty but the expected is to have the value test so users external applications launched from here won't break

@deepak1556
Copy link
Collaborator

A possible way forward would be copy the variables into temporary, unset them in the cli wrapper and restore the temporary as original before application launch.

@forivall
Copy link
Contributor Author

forivall commented Feb 8, 2024

A possible way forward would be copy the variables into temporary, unset them in the cli wrapper and restore the temporary as original before application launch.

Yeah, that was one of the ways I was thinking of, but as I was and am now on my phone on transit, I didn't want to get into it 😅 thanks for the feedback!

@microsoft microsoft locked and limited conversation to collaborators Jun 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warning about Node.js environment variables on launch

2 participants