[cmake-developers] Expected difference in execute_process between MSYS / UNIX
Brad King
brad.king at kitware.com
Thu Oct 30 15:25:27 EDT 2014
On 10/30/2014 01:55 PM, Richard Shaw wrote:
> I'm working on a big update to the FindFLTK module and I'm
> testing it on all platforms I have access to.
>
> One problem that took me quite a while to figure out was that
> on *nix systems, execute_process works with shell scripts but
> on my MSYS2 install it does not, I have to prefix the command
> with "sh" to make sure it executes in a shell.
>
> Is this known/expected?
Yes. It is not execute_process, but the underlying operating
system process launching rules. A shell script starts in a
"shebang" (#!) line that the OS knows how to interpret to
decide what program to run to launch the script. Windows does
not know how to do this so we have to specify a shell explicitly.
MSYS is Windows, not POSIX/Cygwin.
> Should I prefix shell scripts with "sh" in all cases and not
> count on it to work? Or should I test for MSYS and only prefix
> the command with "sh" there?
Using 'sh' should be safe.
-Brad
More information about the cmake-developers
mailing list