open-cli-tools / concurrently

Run commands concurrently. Like `npm run watch-js & npm run watch-less` but better.
https://www.npmjs.com/package/concurrently
MIT License
7k stars 228 forks source link

Spawn error on windows (cygwin) #69

Open rdettai opened 7 years ago

rdettai commented 7 years ago

Concurrently used to work fine for me on windows (cygwin), but since the version 3.0.0 it always triggers the same error:

 Error: spawn /bin/bash ENOENT
     at exports._errnoException (util.js:1036:11)
     at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
     at onErrorNT (internal/child_process.js:359:16)
     at _combinedTickCallback (internal/process/next_tick.js:74:11)
     at process._tickCallback (internal/process/next_tick.js:98:9)
     at Module.runMain (module.js:592:11)
     at run (bootstrap_node.js:394:7)
     at startup (bootstrap_node.js:149:9)
     at bootstrap_node.js:509:3

If you want to reproduce, you can simply use the angular 2 quickstart example and try to run it on this environment.

kimmobrunfeldt commented 7 years ago

Can you upgrade to version 3.1.0 and try again?

rdettai commented 7 years ago

I tried it and had the same issue!

Le 31 oct. 2016 12:59 PM, "Kimmo Brunfeldt" notifications@github.com a écrit :

Can you upgrade to version 3.1.0 and try again?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kimmobrunfeldt/concurrently/issues/69#issuecomment-257243302, or mute the thread https://github.com/notifications/unsubscribe-auth/AHi_g_k-UR0Fnj8xCnBUxuf9cYhE0pw-ks5q5a4OgaJpZM4Kktek .

phsstory commented 7 years ago

as a workaround, 2.2.0 still works

as an aside, the error message is incorrect when using multiple commands, it repeats the same message for all commands. main.js:~326: var command = childrenInfo[event.child.pid].command; event.child.pid is undefined and childrenInfo[undefined] exists This will likely resolve once process spawning is working

kimmobrunfeldt commented 7 years ago

3.0.0 changed the way shells are spawned to allow more flexibility. Check https://github.com/kimmobrunfeldt/spawn-default-shell#spawn-default-shell README for more how it is spawned. It seems that somehow this detection code: https://github.com/kimmobrunfeldt/spawn-default-shell/blob/master/src/get-shell.js#L11 thinks that your shell is indeed /bin/bash but it's not.

You can override this by setting a SHELL=/bin/bash and SHELL_EXECUTE_FLAGS=-l -c (execute flag must be last) environment variables

phsstory commented 7 years ago

in cygwin, our shell is /bin/bash (or others) and spawning should be similar to linux and not require an implicit shell

I personally use babun which is a prepacked no hassle cygwin (http://babun.github.io/)

kimmobrunfeldt commented 7 years ago

I debugged this in a virtual machine. See this issue for more details: https://github.com/kimmobrunfeldt/spawn-default-shell/issues/5.

Temporary workaround for now is to use SHELL=bash concurrently <arguments>.

kentcdodds commented 7 years ago

Does anyone here want to try my fork and let us know whether that works?

npm install https://github.com/kentcdodds/concurrently.git#pr/use-spawn-command
gustavohenke commented 7 years ago

Published v3.3.0 with the fix by @kentcdodds. Could you try it, @rdettai, @phsstory?

marcoso commented 7 years ago

I tried with v3.3.0 and I was still having the issue, as @phsstory mentioned installing v2.2.0 was the only workaround.

mikew commented 7 years ago

Yeah spawn-command does nothing to check the SHELL variable, and the logic that was in spawn-default-shell would still error on Windows if your SHELL is really bash.exe.

ghost commented 6 years ago

I tried to use the latest version of concurrently today and got the same error. Installing version 2.2 did the trick.