shenwei356 / rush

A cross-platform command-line tool for executing jobs in parallel
https://github.com/shenwei356/rush
MIT License
846 stars 63 forks source link

How to run two or more commands in parallel? #27

Closed thalesfsp closed 4 years ago

thalesfsp commented 4 years ago

Prerequisites

Describe your issue

How to run 3 commands in parallel? Sync example: $ echo "Hi!"; echo "House!"; echo "Moon" or $ app1; app2; app3

shenwei356 commented 4 years ago
echo ' app1; app2; app3 ' | rush -j 3 -D ';'   ' {} '
thalesfsp commented 4 years ago

@shenwei356 Would be good, to add that, just as an example, in the README.md

Luc45 commented 3 years ago

When I run rush with 2 jobs in parallel, it tells me that the jobs have started:

echo ' php /var/www/tests/vendor/bin/codecept run webdriver --env single -f;php /var/www/tests/vendor/bin/codecept run webdriver --env multi -f ' | ./rush --verbose -k -j 2 -D ';'   ' {} '
20:28:47.077 [INFO] start cmd #1: php /var/www/tests/vendor/bin/codecept run webdriver --env single -f 
20:28:47.077 [INFO] start cmd #2: php /var/www/tests/vendor/bin/codecept run webdriver --env multi -f 

But the commands do not actually fire. It's not only because there's no output, they actually never do fire, otherwise I would see a browser pop up in a VNC server in my other monitor.

Running the commands individually works:

php /var/www/tests/vendor/bin/codecept run webdriver --env single -f
Codeception PHP Testing Framework v4.1.7
Powered by PHPUnit 9.3.8 by Sebastian Bergmann and contributors.
Running with seed: 

Webdriver (single) Tests (15) ------------------------------------------------------------------------------------------------------------------------------
- cloningCest: Delete site

Am I doing something wrong?

Luc45 commented 3 years ago

It's odd because a simple php --version works:

www-data@76cd1be7d4b2:~/tests$ echo ' php --version;php --version ' | ./rush --verbose -k -j 2 -D ';'   ' {} '
20:34:09.618 [INFO] start cmd #2: php --version 

20:34:09.618 [INFO] start cmd #1: php --version 
20:34:09.671 [INFO] finish cmd #2 in 53.452817ms: php --version 
 : exit status 0
20:34:09.672 [INFO] finish cmd #1 in 53.534728ms: php --version : exit status 0
PHP 7.3.13 (cli) (built: Dec 28 2019 21:22:54) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.13, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.13, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.9.0, Copyright (c) 2002-2019, by Derick Rethans
PHP 7.3.13 (cli) (built: Dec 28 2019 21:22:54) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.13, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.13, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.9.0, Copyright (c) 2002-2019, by Derick Rethans