Skip to content
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

Breaks when command contains &&? #31

Closed
ljharb opened this issue Mar 20, 2016 · 14 comments
Closed

Breaks when command contains &&? #31

ljharb opened this issue Mar 20, 2016 · 14 comments

Comments

@ljharb
Copy link

ljharb commented Mar 20, 2016

If you clone https://github.com/airbnb/mocha-wrap and check out the concurrently branch, you'll see that npm run tests-only fails with, for example, "Error: cannot resolve path (or pattern) '&&'".

I would assume that concurrently 'foo' 'bar' would work for any foo or bar, even if it was multiple commands strung together serially.

The same tests work fine on the master branch with parallelshell.

@rweng
Copy link

rweng commented May 4, 2016

In some cases, running things in parallel is not enough. e.g, i fire up a docker container and then I want to run some integration tests against it. Thus, I thought I'd just sleep a short time before before starting the tests, when they are done -k should take care of stopping the container.

RW-MBP-15:  ~
→ sleep 1 && echo hello
hello

RW-MBP-15:  ~
→ concurrently 'sleep 1 && echo hello'
[0] usage: sleep seconds
[0] sleep 1 && echo hello exited with code 1

@jonkri
Copy link

jonkri commented May 26, 2016

+1

Separating different commands with semi-colon doesn't seem to work either.

@kimmobrunfeldt
Copy link
Contributor

Yeah this sucks and should be fixed. We should have all shell capabilities in the commands but haven't found a good way to do it well cross-platform. I'll try to peak what parallelshell does. If someone has a fix, I'll merge a PR.

@kimmobrunfeldt
Copy link
Contributor

Could you test if this has been fixed by installing 3.0.0-dev version: npm i -g concurrently@3.0.0-dev ?
It should be better now because it is using https://github.com/kimmobrunfeldt/spawn-default-shell for spawning shell.

@ljharb
Copy link
Author

ljharb commented Sep 19, 2016

@kimmobrunfeldt concurrently 'echo 1 && exit 1' 'echo 2 && exit 2' is still incorrectly passing with 3.0.0-dev - that seems to be a simple test case. That's actually worse imo than previous, because now it's silently and erroneously passing.

@kimmobrunfeldt
Copy link
Contributor

What do you mean by "is still incorrectly passing"?

To me this behaviour seems to be correct:

➜  concurrently git:(master) ✗ concurrently 'echo 1 && exit 1' 'echo 2 && exit 2'
[0] 1
[1] 2
[1] echo 2 && exit 2 exited with code 2
[0] echo 1 && exit 1 exited with code 1
➜  concurrently git:(master) ✗ echo $?
1

concurrently returns with exit code 1.

@kimmobrunfeldt
Copy link
Contributor

kimmobrunfeldt commented Sep 19, 2016

@rweng also now concurrently 'sleep 1 && echo hello' works fine:

➜  concurrently git:(master) ✗ concurrently 'sleep 1 && echo hello'
[0] hello
[0] sleep 1 && echo hello exited with code 0

(with the dev version: npm i -g concurrently@3.0.0-dev)

@ljharb
Copy link
Author

ljharb commented Sep 19, 2016

On my machine i was getting a zero exit code.

@kimmobrunfeldt
Copy link
Contributor

kimmobrunfeldt commented Sep 19, 2016

Are you sure you uninstalled the old one and used 3.0.0-dev version? Also are you sure that your platform shell is compatible with those commands?(just making sure, I know that most probably it is compatible) Which OS are you running? E.g in Macs, spawn-default-shell will use the shell defined in SHELL env or /bin/bash -c "..." to run the given commands. I also made a test case for this - it passed on my Mac but I can double check on Travis CI too.

@ljharb
Copy link
Author

ljharb commented Sep 19, 2016

It's a Mac, stock, using bash. I'll try again this evening, just in case something went wrong with my install.

@kimmobrunfeldt
Copy link
Contributor

Ok I'll commit the test case to master later today too.

@kimmobrunfeldt
Copy link
Contributor

@ljharb
Copy link
Author

ljharb commented Sep 19, 2016

Hmm, I must have made a mistake, because I definitely have 3.0.0-dev installed, didn't change anything, and got the proper exit codes. Thanks!

@kimmobrunfeldt
Copy link
Contributor

These issues should be now fixed in 3.0.0-rc1. You can test by installing it: npm i -g concurrently@3.0.0-rc1. Please open a new issue to concurrently repo if this is not the case. I'll release the 3.0.0 soonish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants