Start-Process with a macOS application bundle doesn't support arguments
See original GitHub issueThe problem seems related to the fact that macOS .app
bundles are directories, not single files.
Steps to reproduce
# On macOS
# This should be the equivalent of:
# open -a /Applications/Safari.app http://example.org # or: open -a Safari http://example.org
{ Start-Process /Applications/Safari.app -ArgumentList http://example.org } |
Should -Not -Throw
Expected behavior
The test should succeed, and Safari should open to http://example.org
Actual behavior
The test fails:
Expected no exception to be thrown, but an exception "The FileName property should not be a directory unless UseShellExecute is set." was thrown from
Note that not passing arguments (omitting -ArgumentList
) works as expected
Environment data
PowerShell Core v7.0.0-preview.3 on macOS 10.14.6
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
How can I run an application with command line arguments ...
app bundle, select "Show Package Contents", navigate to Info.plist, double click it, find Args key, edit. I don't have an OS X machine...
Read more >MacOS app - why does CommandLine.arguments of an ...
I think this is because the CommandLine.arguments only works when the app is initially launched and arguments are passed into the main function....
Read more >Signing a Mac Product For Distribution
To get started, decide on your container format. Mac products support two distribution channels: An app can be distributed via the Mac App...
Read more >How to get an application executable path from Terminal
I would like to know if there is a command that returns the executable within the application bundle. There is no such command, ......
Read more >Building a Universal macOS Binary
Create macOS apps and other executables that run natively on both Apple silicon and Intel-based Mac computers.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey @microsoft @satyanadella @PowerShellTeam despite a great bug report from @mklement0 this issue has not been addressed (nor even commented on) by anyone from your team more than three years later. This is exactly the thing that demonstrates that you are not serious about making Powershell actually cross-platform. Please fix the issue or at least comment. Thanks!
Another workaround: