Questions tagged [spawn]

loading and executing a new child process

1125 questions
524
votes
32 answers

How do I debug "Error: spawn ENOENT" on node.js?

When I get the following error: events.js:72 throw er; // Unhandled 'error' event ^ Error: spawn ENOENT at errnoException (child_process.js:1000:11) at Process.ChildProcess._handle.onexit (child_process.js:791:34) What…
laconbass
  • 17,080
  • 8
  • 46
  • 54
308
votes
9 answers

What is an unhandled promise rejection?

For learning Angular 2, I am trying their tutorial. I am getting an error like this: (node:4796) UnhandledPromiseRejectionWarning: Unhandled promise rejection (r …
173
votes
10 answers

Node.js spawn child process and get terminal output live

I have a script that outputs 'hi', sleeps for a second, outputs 'hi', sleeps for 1 second, and so on and so forth. Now I thought I would be able to tackle this problem with this model. var spawn = require('child_process').spawn, temp =…
foklepoint
  • 2,231
  • 2
  • 16
  • 15
109
votes
4 answers

Node.js Spawn vs. Execute

In an online training video I am watching to learn Node, the narrator says that "spawn is better for longer processes involving large amounts of data, whereas execute is better for short bits of data." Why is this? What is the difference between the…
Harrison Cramer
  • 3,792
  • 9
  • 33
  • 61
105
votes
4 answers

Argument passing strategy - environment variables vs. command line

Most of the applications we developers write need to be externally parametrized at startup. We pass file paths, pipe names, TCP/IP addresses etc. So far I've been using command line to pass these to the appplication being launched. I had to parse…
105
votes
6 answers

Node.js catch ENOMEM error thrown after spawn

My Node.js script crashes because of a thrown ENOMEM (Out of memory) errnoException when using spawn. The error: child_process.js:935 throw errnoException(process._errno, 'spawn'); ^ Error: spawn ENOMEM at errnoException…
tobi
  • 1,924
  • 2
  • 20
  • 25
51
votes
2 answers

multiprocessing fork() vs spawn()

I was reading the description of the two from the python doc: spawn The parent process starts a fresh python interpreter process. The child process will only inherit those resources necessary to run the process objects run() method. In particular,…
Crystina
  • 990
  • 1
  • 5
  • 16
35
votes
5 answers

Get 'spawn cmd ENOENT' when try to build Cordova application (event.js:85)

Get this error in windows cmd when I try to build (emulate) Cordova app. D:\dev\Cordova\toDoList>cordova build android Running command: D:\dev\Cordova\toDoList\platforms\android\cordova\build.bat events.js:85 throw er; // Unhandled 'error' event …
valverde93
  • 1,698
  • 1
  • 11
  • 17
34
votes
3 answers

Using nodejs's spawn causes "unknown option -- " and "[Error: spawn ENOENT]" errors

I'm trying to get spawn to effect an rm -rf node_modules followed by npm install (on windows 7; nx commands courtesy of a transparently installed CygWin. All nx commands resolve on a commandline just fine). I initially had this using exec, but…
Mike 'Pomax' Kamermans
  • 49,297
  • 16
  • 112
  • 153
32
votes
2 answers

Node child_process.spawn multiple commands

I wan to automate the creation and extracting of keystore. The problem I'm facing is how to join the commands using the ' | ' symbol or similar solution. //Original Command var command='keytool -exportcert -storepass mypass -keypass mypass …
32
votes
3 answers

How to spawn a new independent process in Python

I have a some Python code that occasionally needs to span a new process to run a shell script in a "fire and forget" manner, i.e. without blocking. The shell script will not communicate with the original Python code and will in fact probably…
Marc
  • 3,386
  • 8
  • 44
  • 68
29
votes
5 answers

Node js get and set data from different process

I've node application which done spawn(child process) to and application, the application have host and port: var exec = require('child_process').spawn; var child = exec('start app'); console.log("Child Proc ID " + child.pid) child.stdout.on('data',…
user4209821
29
votes
3 answers

Nodemon-like task in Grunt : execute node process and watch

I feel like I'm missing something. Here is what I want to achieve : Having a grunt task that executes my server.js and runs watch task in parallel. It feels to me that this is precisely one of the tasks grunt was designed for but I can't achieve…
Augustin Riedinger
  • 20,909
  • 29
  • 133
  • 206
27
votes
1 answer

Spawning process with arguments in node.js

I need to spawn a child process from node.js, whilst using ulimit to keep it from using to much memory. Following the docs, it wasn't hard to get the basic spawn working: child = spawn("coffee", ["app.coffee"]). However, doing what I do below just…
Industrial
  • 41,400
  • 69
  • 194
  • 289
25
votes
2 answers

How to read child_process.spawnSync stdout with stdio option 'inherit'

var childProcess = cp.spawnSync(command, args, { cwd: process.cwd(), env: process.env, stdio: 'inherit', encoding: 'utf-8' }); childProcess.output always eq [null, null, null] process.stdout.write hook doesn't give me any output
nitro-n
  • 423
  • 1
  • 5
  • 9
1
2 3
74 75