Questions tagged [spawn]

loading and executing a new child process

1125 questions
8
votes
2 answers

Indefinite daemonized process spawning in Python

I'm trying to build a Python daemon that launches other fully independent processes. The general idea is for a given shell command, poll every few seconds and ensure that exactly k instances of the command are running. We keep a directory of…
Ryan N
  • 649
  • 2
  • 7
  • 17
8
votes
1 answer

How do I spawn a separate python process?

I need to spawn a separate python process that runs a sub script. For example: main.py runs and prints some output to the console. It then spawns sub.py which starts a new process. Once main.py has spawned sub.py it should terminate whilst sub.py…
KeyPick
  • 103
  • 1
  • 2
  • 5
8
votes
2 answers

How to detect if a Node spawned process is still running?

I can spawn a process like: var spawn = require('child_process').spawn; var topicListener = spawn('python', ['topic_listener.py','Node.js'], {env: { TWITTER_CONSUMER_SECRET: process.env.TWITTER_CONSUMER_SECRET, TWITTER_CONSUMER_KEY:…
diegoaguilar
  • 8,179
  • 14
  • 80
  • 129
8
votes
1 answer

Terminating spawn sessions in expect

I'm trying to address an issue with an Expect script that logs into a very large number of devices (thousands). The script is about 1500 lines and fairly involved; its job is to audit managed equipment on a network with many thousands of nodes. As a…
Eleck
  • 197
  • 1
  • 1
  • 6
8
votes
1 answer

Why is Pexpect intermittently hanging (not detecting EOF) after executing certain commands?

Context: I have some code written using pexpect, whose job is to give "live" output of a command. I.e. print something out when a command generates some output, or soon after, rather than waiting until the command completes and then interacting with…
Zac B
  • 3,796
  • 3
  • 35
  • 52
7
votes
0 answers

Respond to password query in child_process spawn nodejs

Need help figuring this one out. I am trying to call an external application through child process spawn and after calling the application it requests a password. I then get a fatal error and the child process exits. I have tried a few different…
J_ROC
  • 93
  • 6
7
votes
2 answers

How to run some CMD commands on Windows 10 as administrator using Nodejs and spawn?

I am working with Nodejs on Windows 10. Every time the app is opened I want to check if the files with the extension ext are associated to my app. If not I would need to run this commands on cmd in order to make the association again: assoc…
ChesuCR
  • 9,352
  • 5
  • 51
  • 114
7
votes
2 answers

Handle Node.js spawnSync errors

I'm trying to run "npm publish" from a gulp task. It works, but I want to handle any error that npm command itself throws. If I execute this code: var cmd = spawnSync('npm.cmd', ['publish', packageDir], { stdio: 'inherit' }) cmd.stdout and…
Duke
  • 145
  • 3
  • 11
7
votes
1 answer

How to give an Order to the files compiled with coffeebar

I would like to be able to include the file with a given order while compiling my coffeescript files into js with coffeebar. I would like to have the files settings.coffee, constants.coffee included first -- |-- settings.coffee |--…
william.eyidi
  • 2,315
  • 4
  • 27
  • 39
7
votes
1 answer

Node.js: Killing sub processes of ChildProcess#spawn

Consider the following code: import {spawn, exec} from 'child_process'; var child = spawn('su', [process.env.USER, '-c', 'while (true); do sleep 0.3; echo "tick"; done'], {stdio: ['ignore', 'pipe',…
vtambourine
  • 2,109
  • 3
  • 18
  • 27
7
votes
2 answers

C# Detecting Spawned Processes

I'm writing a piece of c# code that launches an installer and waits for it to return before continuing with other stuff. I'm having trouble with certain installers that spawn other processes with the original process returning before the install has…
tjjjohnson
  • 3,270
  • 4
  • 31
  • 33
7
votes
1 answer

Execute shell script in gruntfile and assign result to variable

I am using grunt to manage a suite of mocha-run tests. One of the things required in the mocha test suite is that certain environment variables be set so that the tests are executed properly based on the environment of the developer running the…
Clandestine
  • 1,449
  • 1
  • 13
  • 30
6
votes
2 answers

Python watching for process start up?

Is there any way to watch for a new process with name 'X' starting in python (ideally) or bash? I know that I can look at running processes, but that is not fast enough for my needs. The only think that I can think of is some how hooking into the…
Trcx
  • 4,164
  • 6
  • 30
  • 30
6
votes
1 answer

TaskGroup `async` vs. `spawn`

Does anyone know, in the new Swift async/await stuff, is there any difference between TaskGroup async and spawn, or are they pure synonyms? (If they are synonyms, I rather like spawn better. async looks like we're opening an async block, and that's…
matt
  • 515,959
  • 87
  • 875
  • 1,141
6
votes
1 answer

how to list child processes in nodejs

How to see list of child processes created by Fork and Spawn in nodejs ?
vijay
  • 10,276
  • 11
  • 64
  • 79