Invoking commands (bash script) under MSYS

Hi,

I've already reported this issue here, but I don't know if it's a bug or if I don't know how to use the Command struct.

Basically the problem it seems to be related only to MSYS environment (so Windows stuff) and execution of external application.
After some further investigation it seems that the problem happens when I try to invoke a bash script, if I invoke an executable (like C:\msys64\usr\bin\ls) it works correctly.

This is quite annoying, since it makes compiling project depending on external C/C++ code (that need to launch configure script) very tricky to get to work.

Thank you.

  1. "~" only means anything to bash/sh. You have to write /home/<user> or use std::env::home_dir() to get the current user's home directory.

  2. Linux understands that #!/some/other/binary (called a she-bang) at the beginning of a file means that the file is a script that should be handled by /some/other/binary. Windows doesn't so you have to invoke /some/other/binary yourself.

1 Like

Thank @stebalien.
So the trick (as suggested here) is invoking the bash script (under MSYS) via sh command.