dustinrue / ControlPlane

ControlPlane - context-sensitive computing for OS X
http://www.controlplaneapp.com
BSD 3-Clause "New" or "Revised" License
1.75k stars 180 forks source link

Run a Shell Script broken if the default shell is zsh #493

Open noaho opened 6 years ago

noaho commented 6 years ago

Hi,

I can't run shell scripts with controlplane, I just get (script terminated with a non-zero status '127') even if I use the picker to select the file, and it has correct permissions (755).

Another user reported the same problem while having zsh as his default shell, so I believe this to be related to the problem.

https://github.com/dustinrue/ControlPlane/issues/443#issuecomment-209265087

gamell commented 6 years ago

Same here with fish shell

microbug commented 6 years ago

You may be able to work around this by specifying the full path of any executables in your script. You can get the path of an application by doing command -v name, e.g., command -v python3 returns /usr/local/bin/python3.

fharper commented 3 years ago

ControlPlane is executing the shellscript in bash, I guess the idea would be to add the opportunity to choose which shell you want to use to execute the scripts.

In the meantime, you can call your command like this /bin/zsh -i -c "the command that works in your shell"

-i make the shell interactive, and will read your $HOME/.zshrc file -c run the command after You don't need the double quote if your command doesn't have any arguments

That will be bullet proof since it's also working in zsh also. The only thing is that you are loading the shell each time.