Specify which shell Yarn uses for running scripts
yarn version 1.19 added support for a new config parameter script-shell
. You can now do the following:
yarn config set script-shell /bin/bash
It may launch the command using system
function see also man 3 system
.
To see which system call is used :
strace yarn ...
system
uses fork
+exec
+wait
and the exec family functions uses shell /bin/sh
to use bash the command can be changed to bash -c 'command ..'
Yarn doesn't yet provide a way to configure the default shell used for running scripts, see: https://github.com/yarnpkg/yarn/issues/4248
However, since yarn uses Node for spawning its processes, you can work around that by changing the default shell that Node itself uses.
On Ubuntu, if you have root permissions, you can do this by changing the symlink /bin/sh
to point to something other than dash
:
sudo ln -sf /bin/bash /bin/sh
In Git-bash in Windows, you can change the COMSPEC
environment variable to something other than C:\Windows\system32\cmd.exe
, but I haven't gotten that to work for me.
See also:
- Force node to use git bash on windows