darkguy2008 / parallelshell

Run multiple shell commands in parallel
501 stars 44 forks source link

Issue with assigning variables #45

Closed davesnx closed 7 years ago

davesnx commented 8 years ago
parallelshell "echo 1" "ENV=3"

Hello, You can't declare variables, I guess that is because isn't a process (?). I'm not sure if it's an issue or not. The use case for that is you want to define some env variables at the same time of running a process. i.e.

NODE_ENV=dev node server.js

Edit: Reading the code I'm figuring out what's going on, the child-process spawn is throwing an error.

paulpflug commented 8 years ago

I think, this should work:

parallelshell "ENV=3 echo 1"
davesnx commented 8 years ago

@paulpflug isn't working, it's the same error. The spawn is reading ENV=3 as a command, If I have time I will open a PR with the fix

paulpflug commented 8 years ago

basically parallelshell does a sh -c "command" when I call sh -c "TEST=test env", TEST is there but sh -c "TEST=test echo $TEST" doesn't print anything

seems it is a problem of echo, maybe it computes its own env?

davesnx commented 8 years ago

I don't think so... when u call sh -c "ENV" shows all the ENV of the system Also, when u run parallelshell "TEST=test"throws and error of sh If you run sh -a => Mark variables which are modified or created for export.

paulpflug commented 8 years ago

"TEST=test" should only work for the following command if you want to export to ENV then you have to use "export", but parallelshell doesn't support ENV exchange between different commands.

Am 21. Februar 2016 1:48:50 nachm. schrieb David Sancho notifications@github.com:

I don't think so... when u call sh -c "ENV" shows all the ENV of the system Also, when u run parallelshell "TEST=test"throws and error of sh


Reply to this email directly or view it on GitHub: https://github.com/keithamus/parallelshell/issues/45#issuecomment-186818234