darkguy2008 / parallelshell

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

Ability to set CWD #34

Open barrysteyn opened 9 years ago

barrysteyn commented 9 years ago

Hi Keith

Inspired by your blog post about scrapping grunt etc, and just using NPM, I happily using parallelshell. Unfortunately, there are many cases where I need to set the current working directory (CWD) to run the command in. Now that we are using exec, cd does not work. So I have come up with my own solution, which is to pass parallelshell a JSON array, and if it parses and if it contains two items, the first item will be the CWD. If any of those conditions do not hold, then just use as per normal.

keithamus commented 9 years ago

@barrysteyn could you try checking out #30 and seeing if that works without your changes. #30 is the direction we want to be going in.

barrysteyn commented 9 years ago

Hi @keithamus. From just looking at #30, I think it should be able to do what I need. But I am still of the opinion that one should be able to set the CWD. The way I have done it is a little inelegant for the user. I have not tested #30, but I still advise that there should be some way to set the CWD.

keithamus commented 9 years ago

I don't think it's necessary to set the cwd provided we're spawning shells. I'll agree that the current implementation is broken, but if we merge #30 then you can just do one of the following:

cd /some/folder && parallelshell 'some command'
parallelshell 'cd /some/folder && some command'
Jokero commented 7 years ago

@keithamus When do you plan to merge #30 ? I also need this feature)

darkguy2008 commented 7 years ago

@Jokero I can give it a try and see if it works correctly, then I'll merge :)

Jokero commented 7 years ago

Cool, thank you