loading and executing a new child process
Questions tagged [spawn]
1125 questions
14
votes
2 answers
spawning process from python
im spawning a script that runs for a long time from a web app like this:
os.spawnle(os.P_NOWAIT, "../bin/producenotify.py", "producenotify.py", "xx",os.environ)
the script is spawned successfully and it runs, but till it gets over i am not able to…

mark
- 1,209
- 4
- 12
- 17
14
votes
1 answer
Spawning functions without exporting them
I am new to erlang and have a bit of a headache with the following scenario:
Take this code:
-module (so).
-export ( [foo/0] ).
bar () ->
receive
die -> ok;
Msg -> io:format ("I say ~p.~n", [Msg] )
end.
bar (Name) ->
…

Hyperboreus
- 31,997
- 9
- 47
- 87
14
votes
3 answers
Set global environment variable out of Node.js
I am trying to set a global environment variable out of my node.js app.
The goals are:
When restarting the APP, the environment variable should still be set
When opening a new shell, it should be usable
If possible: When rebooting, same as 1.
It…
user3984802
13
votes
2 answers
Running Node app through Grunt
I am trying to run my Node application as a Grunt task. I need to spawn this as a child process, however, to allow me to run the watch task in parallel.
This works:
grunt.registerTask('start', function () {
grunt.util.spawn(
{ cmd: 'node'
…
user1082754
12
votes
5 answers
Spawn on Node JS (Windows Server 2012)
When I run this through Node:
var spawn = require('child_process').spawn;
ls = spawn('ls', ['C:\\Users']);
ls.on('error', function (err) {
console.log('ls error', err);
});
ls.stdout.on('data', function (data) {
console.log('stdout: ' +…

fire
- 21,383
- 17
- 79
- 114
12
votes
1 answer
node.js spawned process sticks around if script is killed
Is it possible to make sure that processes spawned with node.js child_process will be killed when the parent is killed?
Here's an example script
var spawn = require('child_process').spawn;
var log_tail = spawn("tail", ["-f",…

case nelson
- 3,537
- 3
- 30
- 37
11
votes
1 answer
How can I make child_process.spawn return a Promise in my TypeScript module?
I'm trying to write a little module that uses child_process.spawn to clone a git repo and return a Promise but it fails on me. When I'm using spawnSync it works.
Here is the sync code that works.
import {spawnSync} from 'child_process';
export…

fabianmoronzirfas
- 4,091
- 4
- 24
- 41
11
votes
2 answers
Using two commands (using pipe |) with spawn
I'm converting a doc to a pdf (unoconv) in memory and printing (pdftotext) in the terminal with:
unoconv -f pdf --stdout sample.doc | pdftotext -layout -enc UTF-8 - out.txt
Is working. Now i want use this command with child_process.spawn:
let…
user5526811
11
votes
2 answers
Node child process event listen
I use the node child_process API
https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options
var child = child_process.spawn(cmd, val, options);
from the child I use the following…

07_05_GuyT
- 2,787
- 14
- 43
- 88
11
votes
1 answer
child_process spawn in node.js security / escaping
In Node, I'm using a module (GM) and noticed that it uses spawn from the child_process module to pass arguments to GraphicMagick's convert executable.
I'm passing user-submitted information to GM. Is there a security concern that the user could do…

stockholmux
- 1,169
- 11
- 24
11
votes
2 answers
Capture a child process's stdout with libuv
I'm using libuv. I've read http://nikhilm.github.com/uvbook/processes.html and still cannot work out how to capture the stdout of a child process so that it is available in the parent (but not in place of the parent's stdin).
My code is…

fadedbee
- 42,671
- 44
- 178
- 308
10
votes
1 answer
Detach a spawn child process after the start
I start a spawn child process this way:
let process = spawn(apiPath, {
detached: true
})
process.unref()
process.stdout.on('data', data => { /* do something */ })
When I start the process I need to keep it attached because I want to read its…

Opsse
- 1,851
- 2
- 22
- 38
10
votes
3 answers
C++ best way to launch another process?
Its been a while since I've had to do this and in the past I've used "spawn" to create processes.
Now I want to launch processes from my application asynchronously so my application continues to execute in the background and does not get held up by…

SPlatten
- 5,334
- 11
- 57
- 128
10
votes
1 answer
Why is my Node child process that I created via spawn() hanging?
I am using spawn() to make a git call. Sometimes it works fine but others it appears to be hanging. I see no events firing (error, exit, close) yet I see evidence that the process did in fact complete successfully.
var spawn =…

Tom
- 399
- 4
- 10
9
votes
5 answers
linux: suspend process at startup
I would like to spawn a process suspended, possibly in the context of another user (e.g. via sudo -u ...), set up some iptables rules for the spawned process, continue running the process, and remove the iptable rules when the process exists.
Is…

hanshans
- 91
- 1
- 2