1

I'm trying to call a node js script with spawn, but this script accept arguments and I can't figure out how achieve this:

var build = spawn('node',['src/server/single.js build=complete incrementVersion=true uploadBuild=true')

I know that I can use exec instead of spawn, but I want live output that exec haven't. How can I do it?

EDIT: My problem isn't about pass arguments to a node js script, because I already do it, my problem is to pass argument to node js script using spawn

2

1 Answer 1

2

I think the solution is this:

var child = spawn('node', ['src/server/single.js','app='+name,'build=complete', 'incrementVersion=true', 'uploadBuild=true']);

first argument is the command, second argument is an array with all arguments of the command

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.