More > JRiver Media Center 32 for Mac
Links: Opening External Program
zybex:
I'm confused. Isn't it just a matter of starting the Terminal app with the appropriate args to execute a .sh script or a bash command?
The equivalent in windows is starting cmd.exe with some args, we can't just execute shell commands without invoking cmd or powershell.
bob:
--- Quote from: zybex on February 01, 2024, 11:46:55 am ---I'm confused. Isn't it just a matter of starting the Terminal app with the appropriate args to execute a .sh script or a bash command?
The equivalent in windows is starting cmd.exe with some args, we can't just execute shell commands without invoking cmd or powershell.
--- End quote ---
I actually don't know how that would work on Mac. Right now, the code only allows one arg because of the way the windows args to cmd.exe are specified.
I'm pretty sure that's not going to be the same on Mac
bob:
I'm going to play with changing the behavior based on whether or not the program is a bundle.
If you use the browse command to an App you can get the bundle path otherwise typing in a command on the program line will allow posix style command execution.
MrBiff:
Again, thank you.
Maybe it's time to provide support in Links (and perhaps Send To) that allow users to select powershell 5 or pwsh 7 (aka Core) as the shell that you invoke via CreateProcess*(). You could use then base64 encode the command arguments provided by the user, include the option -EncodedCommand, and this eliminates all quoting and shell meta-character ambiguity. Users get true ARGV like behavior without all the garbage rules and limitations foisted on users for the past 30+ years.
bob:
--- Quote from: bob on February 01, 2024, 12:27:09 pm ---I'm going to play with changing the behavior based on whether or not the program is a bundle.
If you use the browse command to an App you can get the bundle path otherwise typing in a command on the program line will allow posix style command execution.
--- End quote ---
Ok so here is what will be in the next build.
The arguments for Mac (and linux) should be separated thusly
"arg1" "arg2" "arg3" and so forth. Expressions would be like this "[Filename]" as an arg.
If MacOS finds an bundled app in the path which would be the case if you used browse, it will pass the command and args to the App via the MacOS API.
If the path for the executable is not an app (you typed it in), we'll use the vfork call.
So for example, if I try a command of
/bin/ls
and args of
"-l" "[Filename]"
I see an extended listing of the file on standard output.
You are welcome to play around with this using shell, terminal, whatever and it should work as long as you get the args right.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version