-
Notifications
You must be signed in to change notification settings - Fork 85
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
Shell commands invoke /bin/sh directly #253
Comments
First, my general recommendation is to avoid using the As for your comments: the only standards-compliant possibility is to call I'd certainly welcome a PR adding some warning documentation about this. |
Hello, could you please consider exposing the shell execution command as part of the I could try to make a PR, but I'm not proficient enough in Haskell, plus the current code is fairly messy. |
I'm not sure what you mean by "expose the shell execution command". Do you mean to make that a configurable parameter of |
Yes, but that does not work when you want to perform say Then you might recommend creating a temp file with all the commands to be executed by a specific shell and use that as input of a |
I don't understand. How would you run |
You would use Both If on the other hand I could configure |
But if you can do it by configuring proc "powershell.exe" ["New-Item"] |
I am a maintainer of the obelisk framework. This week, I had to debug a very strange issue where some shell escaping was "working on my machine"™, but not my friend's. obelisk provides an integrated development environment that uses nix to ensure consistent behavior across platforms. In particular, we try to lock down which shell that is used when we invoke other executables.
However, we cannot ensure that our dependencies that use System.Process choose a shell in a way we can modify: In particular, ghcid uses
System.Process.shell
, and so on my machine, where/bin/sh
isbash
, and my friend's machine, where/bin/sh
isdash
, the behavior of shell escaping is different, and this causesghcid
to fail to invoke it's--command
argument correctly.My gut is that, just as one would reflexively invoke
#!/usr/bin/env bash
in a shell script that one wants to be portable, one would wantSystem.Process
to invoke/usr/bin/env sh -c <cmd>
instead of/bin/sh -c <cmd>
directly. Otherwise, the user cannot control the shell that is used at all without invasively modifying their entire system environment. A user may be surprised that the shell that they use to run their haskell program is not the same shell used to invoke shell commands from within the program, for example. I was surprised, at least!This would be a rather significant change to the behavior of shell commands, so I'm not sure if that this change is desirable. At the least, a warning about portability would be appreciated.
The text was updated successfully, but these errors were encountered: