Ricardo
Ricardo

Reputation: 2943

Execute commands in queue and async

NodeJS newbie (this is my first node app). How can I execute commands (from the command line) in order? Like in a queue, one after another. Note that some commands could take several seconds. I would like to do it without blocking node, in an asynchronous way.

Is this what I need: https://www.npmjs.com/package/command-queue

I find strange having to call RUN every time I add a command. I mean, the queue should work always.

Thanks a lot for suggestions.

Upvotes: 1

Views: 851

Answers (1)

Pat Needham
Pat Needham

Reputation: 5938

The npm package you listed looks reasonable, and it has an async method where you can list the commands one after another:

new CommandQueue()
.async(
    'karma start',
    'webpack-dev-server --hot'
)
.run();

Upvotes: 2

Related Questions