Giter Site home page Giter Site logo

parallelshell's Introduction

Parallel Shell

This is a super simple npm module to run shell commands in parallel. All processes will share the same stdout/stderr, and if any command exits with a non-zero exit status, the rest are stopped and the exit code carries through.

Version compatibility notes

  • Fully compatible with Node up to v8 and later!

Maintenance has been resumed by @darkguy2008. However, there are also better options, see Consolidation of multiple similar libraries.

Motivation

How is this different than:

$ cmd1 & cmd2 & cmd3
  • Cross platform -- works on Unix or Windows.

  • & creates a background process, which only exits if you kill it or it ends. parallelshell will autokill processes if one of the others dies.

  • command1 & command2 & command3 will wait in the terminal until command3 ends only. parallelshell will wait until all 3 end.

  • If command1 or command2 exit with non-zero exit code, then this will not effect the outcome of your shell (i.e. they can fail and npm/bash/whatever will ignore it). parallelshell will not ignore it, and will exit with the first non-zero exit code.

  • Pressing Ctrl+C will exit command3 but not 1 or 2. parallelshell will exit all 3

  • parallelshell outputs all jobs stdout/err to its stdout/err. background jobs do that... kind of coincidentally (read: unreliably)

So what's the difference between GNU parallel and this?

The biggest difference is that parallelshell is an npm module and GNU parallel isn't. While they probably do similar things, albeit (GNU) parallel being more advanced, parallelshell is an easier option to work with when using npm (because it's an npm module).

If you have GNU parallel installed on all the machines you project will be on, then by all means use it! :)

Install

Simply run the following to install this to your project:

npm i --save-dev parallelshell

Or, to install it globally, run:

npm i -g parallelshell

Usage

To use the command, simply call it with a set of strings - which correspond to shell arguments, for example:

parallelshell "echo 1" "echo 2" "echo 3"

This will execute the commands echo 1 echo 2 and echo 3 simultaneously.

Note that on Windows, you need to use double-quotes to avoid confusing the argument parser.

Available options:

-h, --help         output usage information
-v, --verbose      verbose logging
-w, --wait         will not close sibling processes on error

parallelshell's People

Contributors

ajay-gupta avatar chaines avatar darkguy2008 avatar dracos avatar eliias avatar jackysee avatar keithamus avatar nichoth avatar paulpflug avatar pik avatar skooda avatar wayneashleyberry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

parallelshell's Issues

Allow 3.0 to be backwards compatible with < Node 8

Currently NPM does not allow specifying multiple versions of the same package (npm/npm#5499) or determining which package to use based on engine version.

Parallelshell existing in 2 incompatible variants is highly unsatisfactory, since this means developers have no good way to maintain working code for Node 8 as well as < Node 8 users. As far as I can tell from this commit 11e1d29 the only breaking change is cwd / cwd() that could be a quick process.node.version > '8.0.0' ? process.cwd : process.cwd()

Is there a way to close after N seconds?

I am using parallelshell to perform end 2 end testing, like starting a server and then making a request from another script. Most of the time, there is no error, and the request script finishes with exit code 0. Is there an option to kill everything after N second timeout if the processes have not finished before with a non-zero code?

TypeError: "cwd" must be a string

Hi,

This isn't an issue for me at the moment but though you might like to be aware of it.

I was getting this error when running ParallelShell (V2.0.0):

> [email protected] serve /Users/amci/Sites/business/app/support-app
> parallelshell 'npm run server' 'npm run watch:sass' 'npm run watch:javascript'

/Users/amci/Sites/business/app/support-app
child_process.js:400
    throw new TypeError('"cwd" must be a string');
    ^

TypeError: "cwd" must be a string
    at normalizeSpawnArguments (child_process.js:400:11)
    at exports.spawn (child_process.js:485:38)
    at /Users/amci/Sites/business/app/support-app/node_modules/parallelshell/index.js:105:17
    at Array.forEach (native)
    at Object.<anonymous> (/Users/amci/Sites/business/app/support-app/node_modules/parallelshell/index.js:100:6)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] serve: `parallelshell 'npm run server' 'npm run watch:sass' 'npm run watch:javascript'`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/amci/.npm/_logs/2017-06-28T16_19_59_702Z-debug.log

I went to the file /Users/amci/Sites/business/app/support-app/node_modules/parallelshell/index.js:105:17 and found the offending line.

When I was logging process.cwd it was a function, not a string. Changing it to process.cwd() fixed the issue.

Difference between GNU Parallel?

Can you explain what the difference is between parallelshell and GNU Parallel? Specifically:

parallel --halt now,fail=1 ::: "echo 1" "echo 2" "echo 3"

why not simply use &

Greetings,

First off, thanks for the helpful article on using npm's package.json as a build tool. I'm trying to get off large-footprint tools for some projects and this is a sweet little approach.

When considering the use of parallelshell, however, I'm not sure what the benefit of it is over simply using &, between command which also executes them in parallel.

Having tested both approaches, each seem to work. Simply using & seems a bit faster, too.

ERR_INVALID_ARG_TYPE error for Node v10.5.0

Hello,

I am trying to test parallelshell (package.json at the bottom of this issue for ref) simply running echo commands, but I get the following:

[email protected] echo1echo2 C:\Users\Public\r\b\c
> parallelshell "echo 1" "echo 2"

child_process.js:420
throw new ERR_INVALID_ARG_TYPE('options.cwd', 'string', options.cwd);
^

TypeError [ERR_INVALID_ARG_TYPE]: The "options.cwd" property must be of type string. Received type function
at normalizeSpawnArguments (child_process.js:420:11)
at spawn (child_process.js:522:38)
at C:\Users\Public\repos\Bootstrap4\conFusion\node_modules\parallelshell\index.js:104:17
at Array.forEach ()
at Object. (C:\Users\Public\r\b\c\node_modules\parallelshell\index.js:100:6)
at Module._compile (internal/modules/cjs/loader.js:702:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
at Module.load (internal/modules/cjs/loader.js:612:32)
at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
at Function.Module._load (internal/modules/cjs/loader.js:543:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] echo1echo2: parallelshell "echo 1" "echo 2"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] echo1echo2 script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\username\appdata\Roaming\npm-cache_logs\2018-06-27T08_21_16_022Z-debug.log

The package I have installed in my project folder has the following package.json file:

{
"_from": "parallelshell",
"_id": "[email protected]",
"_inBundle": false,
"_integrity": "sha512-aW73W8tmYiFZtQi41pweV3WWT6o/EvSxAVQHbumOhN53H47OuWQwrRc11xQ2i44GFvR5AjtzhD92r8Kv9X+7Iw==",
"_location": "/parallelshell",
"_phantomChildren": {},
"_requested": {
"type": "tag",
"registry": true,
"raw": "parallelshell",
"name": "parallelshell",
"escapedName": "parallelshell",
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#DEV:/",
"#USER"
],
"_resolved": "https://registry.npmjs.org/parallelshell/-/parallelshell-3.0.2.tgz",
"_shasum": "fffc55aaa145bdd44b5381cf7fd5e521fc21aa7b",
"_spec": "parallelshell",
"_where": "C:\Users\Public\repos\Bootstrap4\conFusion",
"author": {
"name": "DARKGuy",
"email": "[email protected]"
},
"bin": {
"parallelshell": "./index.js"
},
"bugs": {
"url": "https://github.com/darkguy2008/parallelshell/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Invoke multiple commands, running in parallel",
"devDependencies": {
"bluebird": "^3.5.0",
"chai": "^4.0.2",
"coffee-script": "^1.12.6",
"mocha": "^3.4.2"
},
"homepage": "https://github.com/darkguy2008/parallelshell",
"keywords": [
"parallel",
"shell"
],
"license": "MIT",
"main": "index.js",
"name": "parallelshell",
"repository": {
"type": "git",
"url": "git+ssh://[email protected]/darkguy2008/parallelshell.git"
},
"scripts": {
"test": "mocha"
},
"version": "3.0.2"
}

Thank you so much. Sorry if I was all over the place or something. I'm new to this.

Arian

child_process throwing error ('"cwd" must be a string')

throw new TypeError('"cwd" must be a string');
TypeError: "cwd" must be a string
at normalizeSpawnArguments (child_process.js:380:11)
at exports.spawn (child_process.js:465:38)

The problem comes from cwd: process.cwd,
I am thinking this could be solved executing the function to get the current path directory string: cwd: process.cwd(),

Using node 8.0.0 and npm 5.0.1

Clarify purpose of module

Is it only for cross-platform scripts?

Or is it different than this bash syntax:

$ cmd1 & cmd2 & cmd3

Recursive call fails on Windows

The command:

parallelshell "echo foo" "parallelshell ""echo bar"" ""echo baz"" "

Results in:

foo
'\"echo' is not recognized as an internal or external command,
operable program or batch file.
'bar\"' is not recognized as an internal or external command,
operable program or batch file.
`"echo` failed with exit code 1
`parallelshell "echo bar" "echo baz" ` failed with exit code 1

Docs: mention `a & b & wait`

The docs make a comparison with:

cmd1 & cmd2 & cmd3

But really you should compare it with:

cmd1 & cmd2 & cmd3 & wait

This will wait until all commands have terminated. But yes, ^C will not abort all commands unlike parallel-shell.

Feature request: Prefix output with (colored?) indicator of which process it came from

After having used docker-compose in the past, I really liked the way it showed output from all of the processes it runs. Here's a screenshot:

Docker-compose screenshot

It would be nice if parallelshell allowed me to specify a "name" for each process and automatically choose a different color for each prefix. If a name was not given, it would fall back to using the name of the command that was run.

The npm package "concurrently" offers something similar, but the prefixes are not colored and the package itself does not handle colored output well in general.

I'd be happy to work on a pull request if this is something that would be useful!

Combination of lint + test coverage report throws

I see it pretty awkward. Same issue for concurrently

21:03 $ `npm bin`/parallelshell '`npm bin`/eslint .' '`npm bin`/karma start ./karma.conf.js --single-run --reporters coverage' -w

fs.js:691
  return binding.lstat(pathModule._makeLong(path));
                 ^
Error: ENOENT, no such file or directory '/Users/nkbt/nkbt/react-component-template/reports/coverage/prettify.js'
    at Object.fs.lstatSync (fs.js:691:18)
    at Object.realpathSync (fs.js:1279:21)
    at executeOnFile (/Users/nkbt/nkbt/react-component-template/node_modules/eslint/lib/cli-engine.js:559:27)
    at Array.forEach (native)
    at /Users/nkbt/nkbt/react-component-template/node_modules/eslint/lib/cli-engine.js:626:49
    at Array.forEach (native)
    at CLIEngine.executeOnFiles (/Users/nkbt/nkbt/react-component-template/node_modules/eslint/lib/cli-engine.js:622:18)
    at Object.cli.execute (/Users/nkbt/nkbt/react-component-template/node_modules/eslint/lib/cli.js:159:95)
    at Object.<anonymous> (/Users/nkbt/nkbt/react-component-template/node_modules/eslint/bin/eslint.js:61:20)
    at Module._compile (module.js:456:26)
Hash: c026f8c83672b2f634d8
Version: webpack 1.12.2
Time: 5ms
webpack: bundle is now VALID.
webpack: bundle is now INVALID.
Hash: 95583aaf2ae88eb15123
Version: webpack 1.12.2
Time: 1284ms
        Asset    Size  Chunks             Chunk Names
test/index.js  675 kB       0  [emitted]  test/index.js
chunk    {0} test/index.js (test/index.js) 605 kB [rendered]
webpack: bundle is now VALID.
27 09 2015 21:03:32.066:INFO [karma]: Karma v0.13.10 server started at http://localhost:9876/
27 09 2015 21:03:32.070:INFO [launcher]: Starting browser PhantomJS
27 09 2015 21:03:32.917:INFO [PhantomJS 1.9.8 (Mac OS X 0.0.0)]: Connected on socket lccv0AtAaeh84-jHAAAA with id 72480645
---------------|----------|----------|----------|----------|----------------|
File           |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
---------------|----------|----------|----------|----------|----------------|
 src/          |    88.89 |      100 |       50 |    66.67 |                |
  Component.js |    88.89 |      100 |       50 |    66.67 |              6 |
---------------|----------|----------|----------|----------|----------------|
All files      |    88.89 |      100 |       50 |    66.67 |                |
---------------|----------|----------|----------|----------|----------------|

Node 0.10.40

"'npm' is not recognized as an internal or external command, operable program or batch file"

Trying to use this to run multiple tasks as defined here:
http://blog.keithcirkel.co.uk/how-to-use-npm-as-a-build-tool/

I want to run browser-sync and sass at the same time. Here's my scripts portion of my package.json

  "scripts": {
    "prestart": "npm install",
    "start": "parallelshell 'npm run watch:browser-sync' 'npm run watch:sass'",
    "watch:browser-sync": "browser-sync start --proxy portal --files 'Web/static/css/*.css' & sass --watch sass:css",
    "watch:sass": "sass --watch Web/static/sass:Web/static/css"
  },

When I run "npm start" I can see it tries to run the parallelshell command but it errors out.

parallelshell 'npm run watch:browser-sync' 'npm run watch:sass'

''npm' is not recognized as an internal or external command,
operable program or batch file.
'npm failed with exit code 1

Unsure if this is due to the new version of npm or if I'm doing something wrong. Any insights?

Thanks

New release?

Latest 2.0.0; 6 commits to master since this release

@keithamus there seems to be inconsistencies with GitHub releases and what is on npm?

Node 10.x version check fails

This line fails on Node 10.x since it's checking the version with string comparison and 10 is less than 8 in that case.

This could be replaced with:

cwd: Number(process.versions.node.split('.')[0]) < 8
  ? process.cwd
  : process.cwd(),

Or the entire section with:

// start the children
children = [];
var nodeVer = Number(process.versions.node.split('.')[0]);

cmds.forEach(function (cmd) {
    if (process.platform !== 'win32') {
      cmd = 'exec ' + cmd;
    }

    var child = spawn(sh, [shFlag, cmd], {
        cwd: nodeVer < 8 ? process.cwd : process.cwd(),
        env: process.env,
        stdio: ['pipe', process.stdout, process.stderr]
    }).on('close', childClose);

    child.cmd = cmd
    children.push(child)
});

Preserving colorized output

Very cool package. One thing I'd love to see is the preservation of colored terminal output. Right now the color is stripped out. Would this be something that is possible to add in?

Some output goes to the wrong terminal tab with two tabs open

I'm not even sure how this is possible, but it's happening nonetheless.

Running OS X latest with two terminal tabs:

  1. normal entry mode on a directory
  2. parallelshell with two npm scripts running in watch mode

I save a file I'm working on and the change notification piped to stdout somehow ends up on my first terminal tab. Weird right?

Same argument passed to all shells?

In my npm scripts I've got something like this

    "js:build:dev": "parallelshell 'npm run js:build:renter -- -d' 'npm run js:build:manage -- -d' 'npm run js:build:blog -- -d' 'npm run js:build:cms -- -d'",
    "js:build": "parallelshell 'npm run js:build:renter' 'npm run js:build:manage' 'npm run js:build:blog' 'npm run js:build:cms'",

Where js:build:dev is passing the -d param to each sub script.

It'd be really nice if I could instead have

   "js:build:dev": "npm run js:build -- -d",
    "js:build": "parallelshell 'npm run js:build:renter' 'npm run js:build:manage' 'npm run js:build:blog' 'npm run js:build:cms'",

And have that -d passed down into each script.

If you don't think this is a silly idea I could take a shot at a pull request, but I might need a pointer as to where to look.

Exit code is 0 when first command succeeds and second fails

With single command the exit code is as expected:

$ parallelshell "ls asdf"
ls: asdf: No such file or directory
$ echo $?
1

With multiple commands it exits with 1 when the first command exits with 1:

$ parallelshell "ls asdf" "ls ."
asdf: No such file or directory
$ echo $?
1

But when the first command succeeds and second fails, it exits with 0:

$ parallelshell "ls ." "ls asdf"
asdf: No such file or directory
$ echo $?
0

I tried using --wait but then it always exits with 0.

But the documentation says:

If command1 or command2 exit with non-zero exit code, then this will not effect the outcome of your shell (i.e. they can fail and npm/bash/whatever will ignore it). parallelshell will not ignore it, and will exit with the first non-zero exit code.

run command then parallelshell commands

Hey Keith,
Great blog post, thank you for inspiring me to remove gulp/grunt from my build process!!!

I just have one problem when using parallelshell; maybe you could help me to get it to work?

My use case:
clean a folder then start two processes with parallelshell, they are webpack and browser-sync.

My script looks like this: "start": "npm run clean && parallelshell 'npm run dev_watch' 'npm run dev'"

this runs all the processes, but browser-sync does not pickup the changes.
When i run "start": "parallelshell 'npm run dev_watch' 'npm run dev'" it woks just fine.

How could I run the clean task once at start and still get the other tasks to work properly?

I tried it synchronously "start": " run clean & parallelshell 'npm run dev_watch' 'npm run dev'" with the same unfulfilling result as the parallel one.

Thanks for your great work again!
Maybe you can shed some light on this for me.

Shortcut for running npm scripts

It'd be nice if parallelshell has a shortcut for running npm scripts, something like:

parallelshell 'npm run build' # old style
parallelshell -n 'build' # shorthand style

We could also use globbing here, to expand multiple npm scripts; for example:

parallelshell 'npm run build:js' 'npm run build:css' 'npm run build:html' # old style
parallelshell -n 'build:js' -n 'build:css' -n 'build:html'  # new shorthand style
parallelshell -n 'build:*' # new shorthand style with globs

Of course, each string would have the -n flag so they could be mixed and matched:

parallelshell 'npm run build:js' 'echo normal command' 'npm run build:html' # old style
parallelshell -n 'build:js' 'echo normal command' -n 'build:html' # new shorthand style

/usr/bin/env: ‘node\r’: No such file or directory ...

Two things:

  1. If you are working on Linux/OS X you will have the following issue:
    /usr/bin/env: ‘node\r’: No such file or directory ...
    This is bc file is saved with line separator CRLF instead LF, just save the index.js using LF line separator will solve the issue

  2. index.js on version 3.0.0 is the same as the previous version, it does not has any change, still cwd: process.cwd, instead cwd: process.cwd(). Developer made the change on test/index.coffee but never on index.js file

The "options.cwd" property must be of type string. Received type function

I have node 11.0.0 and I have this issue when I use yarn start because a internal command by parallelshell isn't work. I've been use npm-run-all and I've been use the last version of parallelshell and the issue is continue.

the complete error is :

**
child_process.js:417
throw new ERR_INVALID_ARG_TYPE('options.cwd', 'string', options.cwd);
^

TypeError [ERR_INVALID_ARG_TYPE]: The "options.cwd" property must be of type string. Received type function
at normalizeSpawnArguments (child_process.js:417:11)
at spawn (child_process.js:532:38)
**

can anybody help me please ?

Shut down all children on SIGTERM

I see that parallelshell responds to the SIGINT signal by cleanly shutting down all it's children.

However, when stopped with the SIGTERM signal it simply exits, leaving all it's spawned children running.

Is this intentional behaviour?

npm ERR! code ELIFECYCLE

Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:246:19)
at onErrorNT (internal/child_process.js:427:16)
at processTicksAndRejections (internal/process/next_tick.js:76:17)
at process.runNextTicks [as _tickCallback] (internal/process/next_tick.js:51:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:804:11)
at internal/main/run_main_module.js:21:11
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:252:12)
at onErrorNT (internal/child_process.js:427:16)
[... lines matching original stack trace ...]
at internal/main/run_main_module.js:21:11
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] watch:all: parallelshell "npm run watch:scss" "npm run lite"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] watch:all script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Roaming\npm-cache_logs\2020-05-08T14_50_07_742Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: npm run watch:all
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Roaming\npm-cache_logs\2020-05-08T14_50_08_063Z-debug.log

fails on node8

basically #49

TypeError: "cwd" must be a string
at normalizeSpawnArguments (child_process.js:380:11)
at exports.spawn (child_process.js:465:38)
at ....node_modules/parallelshell/index.js:104:17

cant set env vars on 2.0.0

I think this is because of the switch to exec.

this used to work:
parallelshell \"NODE_ENV=development nodemon index.js\" \"node webpack-server.js\" \"npm run watch\"

now it throws

parallelshell "export NODE_ENV=development && nodemon index.js"  "node webpack-server.js" "npm run watch"

sh: 1: exec: export: not found
....

Suggestions for why parallelshell breaks node-notifier?

I've wanted to add notification to the end of some of my build paths and have run into issues where I'm using parallelshell for watching. That is, the same set of commands ( build:scripts, build:templates, etc. ) are called by two paths, either a npm run build or npm run watch.

In the case of the former, the build script simply calls npm run build:scripts && npm run build:templates.

In the case of the latter, there are nodemon's watching a directory that call the corresponding script ( build:scripts, build:templates, etc. ) as things become available.

If I put a call to notify in, say, build:templates, it works fine if I call it directly ( either npm run build or npm run build:templates ). However, if it is called inside parallelshell it fails ( npm run watch -> nodemon ).

You can try it out for yourself by using this simple package:

{
  "dependencies": {
    "node-notifier": "^4.5.0",
    "parallelshell": "^2.0.0"
  },
  "scripts": {
    "works": "npm run notify",
    "broken": "parallelshell \"npm run notify\"",
    "notify": "notify -t \"Some Title\" -m \"Some Message\" || echo 'failed'"
  }
}

Ctrl-C only kill the first process

I'm using parallelshell in npm script right now and it's working great, but the only problem I'm having right now is that when I run three commands using parallelshell and when hit Ctrl-C it will only kill the first process and left the other two running in the foreground.

    "start": "parallelshell \"npm run serve\" \"npm run watch-css\" \"npm run watch-js\"",

Where as doing:

    "start": "npm run serve & npm run watch-css & npm run watch-js",

The above command will kill all three completely when you hit Ctrl-C.

I'm not sure if this is a bug but trying to figure out how to deal with this.

Does not respect -s flag for npm

I was inspired by this excellent article, and tried to create the following npm script.

"build": "parallelshell \"npm run build:client-js -s\" \"npm run build:html -s\""

As seen in several examples from the article. However, the -s switch is not doing its job. The standard output is still showing all the normal work for each task. I am on Windows 7

process.argv.slice(2) not working for single quotes

Trying this script:

"dev": "parallelshell 'npm run livereload -s' 'npm run serve -s' 'npm run watch -s'"

Yields the following errors:
''npm' is not recognized as an internal or external command, operable program or batch file.
'run' is not recognized as an internal or external command, operable program or batch file.
'livereload' is not recognized as an internal or external command, operable program or batch file.
''npm' is not recognized as an internal or external command, operable program or batch file.
'run' is' not recognized as an internal or external command, operable program or batch file.
'serve' is not recognized as an internal or external command, operable program or batch file.
''npm' is not recognized as an internal or external command, operable program or batch file.
'run' is not recognized as an internal or external command, operable program or batch file.

As you can see, it's ignoring the quotes and just treating everything separated by whitespace as a separate command.

I'm on Windows 10 Command Prompt and Parallelshell 2.0. I get the same results from the command line when I use single quotes. It works fine from the command line with double quotes.

Issue with assigning variables

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.

The "options.cwd" property must be of type string. Received type function

I have node 11.0.0 and I have this issue when I use yarn start because a internal command by parallelshell isn't work. I've been use npm-run-all and I've been use the last version of parallelshell and the issue is continue.

the complete error is :

**
child_process.js:417
throw new ERR_INVALID_ARG_TYPE('options.cwd', 'string', options.cwd);
^

TypeError [ERR_INVALID_ARG_TYPE]: The "options.cwd" property must be of type string. Received type function
at normalizeSpawnArguments (child_process.js:417:11)
at spawn (child_process.js:532:38)
**

can anybody help me please ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.