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
Collaborator

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
Collaborator 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
Collaborator 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
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
7 participants
@joaomoreno @bpasero @deepak1556 @memeplex @rzhao271 @segevfiner and others