Skip to content
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

Launch the app via open cmd on macOS #102975

Closed
deepak1556 opened this issue Jul 20, 2020 · 7 comments · Fixed by #131213
Closed

Launch the app via open cmd on macOS #102975

deepak1556 opened this issue Jul 20, 2020 · 7 comments · Fixed by #131213
Assignees
Labels
engineering VS Code - Build / issue tracking / etc. insiders-released Patch has been released in VS Code Insiders macos Issues with VS Code on MAC/OS X on-testplan

Comments

@deepak1556
Copy link
Contributor

deepak1556 commented Jul 20, 2020

Currently some users hit an issue where the app launched from command line doesn't have an active dock icon, menu and the window cannot be focused.

Thanks for help from @MarshallOfSound with the debugging we were able to narrow the source of issue. The cli wrapper is a node process which then spawns the actual app https://github.com/microsoft/vscode/blob/master/src/vs/code/node/cli.ts#L331 , this doesn't work well with entitlements. Can read for some background about inherited entitlements #95062 (comment) .

The underlying issue is not known here but we expect some sort of malformed state has been entered by the entitled app. To fix this we can adjust the spawn callsite with a call to macOS open cmd.

@deepak1556 deepak1556 self-assigned this Jul 20, 2020
@deepak1556 deepak1556 added engineering VS Code - Build / issue tracking / etc. macos Issues with VS Code on MAC/OS X labels Jul 20, 2020
@deepak1556 deepak1556 added this to the July 2020 milestone Jul 20, 2020
@bpasero
Copy link
Member

bpasero commented Jul 21, 2020

@deepak1556 we have to be careful to still support our command line flags. Here is a simple test that fails if we switch to open:

  • run alias code='open -b com.microsoft.VSCode "$@"' in terminal
  • type code --list-extensions
  • it fails

See also some related discussion in #60579

//cc @joaomoreno

@deepak1556
Copy link
Contributor Author

@bpasero the open command is only meant to be used for spawning the final app executable https://github.com/microsoft/vscode/blob/master/src/vs/code/node/cli.ts#L331, it is not meant to replace the cli wrapper which respects those command line arguments.

const child = spawn('open', ['-b', 'com.microsoft.VSCode', '--args', argv], options);

@bpasero
Copy link
Member

bpasero commented Jul 21, 2020

@deepak1556 oh I see!

@joaomoreno
Copy link
Member

LGTM!

@segevfiner
Copy link
Contributor

Might also be related to #60579

@deepak1556
Copy link
Contributor Author

Thanks @segevfiner , definitely is related to this issue.

@memeplex
Copy link

Will this work with the --wait flag? Currently launching code with that flag produces not only recent icon duplicates but also duplicated icons in the app switcher (#112782). Neither open -b com.microsoft.VSCode --wait nor open -W -b com.microsoft.VSCode --wait work properly (even when the editor is closed, the command at the CLI keeps waiting).

@rzhao271 rzhao271 self-assigned this Aug 4, 2021
@rzhao271 rzhao271 added this to the August 2021 milestone Aug 4, 2021
@bpasero bpasero moved this from New to To do in Electron Integration Aug 9, 2021
@bpasero bpasero moved this from To do to In progress in Electron Integration Aug 16, 2021
@rzhao271 rzhao271 modified the milestones: August 2021, September 2021 Aug 20, 2021
@bpasero bpasero moved this from In progress to Done / Deferred in Electron Integration Sep 20, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Oct 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
engineering VS Code - Build / issue tracking / etc. insiders-released Patch has been released in VS Code Insiders macos Issues with VS Code on MAC/OS X on-testplan
Projects
Archived in project
Electron Integration
  
✔️ Done / Deferred
7 participants
@joaomoreno @bpasero @deepak1556 @memeplex @rzhao271 @segevfiner and others