Questions tagged [child-process]
For questions regarding child-process
2,108
questions
2
votes
0
answers
11
views
Node.js execFileSync & execFile merge a stdout and stderr
I'm trying to retrieve the complete output of a script called on a server (stdout + stderr).
But I do not succeed to retrieve a stdout + stderr merged string.
I tried to pass writable streams as ...
0
votes
1
answer
18
views
Electron.js - Send child process' spawn stdout data to renderer in realtime
I have a simple node child process that invokes a script and that script takes time to output some information (kinda like how ping works).
let command = spawn(
execPath,
[...args],
{...
0
votes
0
answers
20
views
Using main process exit signal, to controllably shut down child processes?
For a personal project, I need child processes to be shut down separately from the main process and at different intervals. So practically, I would press Ctr+C in the console, that would be bound to a ...
1
vote
0
answers
43
views
child_process cant input after some time
I am working on a live terminal in the browser over socket.io. And I encountered the following problem:
When I hardcode the writing to the input stream it works fine, but when I do it after some time (...
1
vote
1
answer
30
views
Node.js execSync redirect stderr to stdout
I'm trying to redirect the subprocess stderr to it's stdout with:
let buffer = execSync("echo hello 1>&2", {stdio : ["pipe","pipe", 1]});
console.log("Result: ...
3
votes
1
answer
43
views
Check if child_process can run a command in NodeJS
how can I check if child_process can run a command?
'echo' is a valid command that can be run in a terminal, but 'echoes' is not one. For example, if I do this
const cp = require('child_process')
cp....
0
votes
0
answers
13
views
Using Child Process with Worker / Thread Pool Returns "TypeError: Converting circular structure to JSON"
I want to use cp.spawn to create limited / queued concurrent processes, for example parallel running tests can be up to 5.
I've tried to implement this using with workerpool.
index.js
const workerpool ...
0
votes
0
answers
41
views
Google App Engine adding child_process causes CORS error
I have an express server, which works locally, but when I deploy it to App Engine and send a request I get the response that it has been blocked by CORS policy. If I remove the section where I call ...
0
votes
0
answers
17
views
Executing linux commands and answering the prompts asked by them after they are run in nodejs [duplicate]
I know we can execute shell commands using nodejs by using spawn function of "child_process" of module like this-
const { spawn } = require("child_process");
const child = spawn(&...
0
votes
0
answers
24
views
How to avoid child process termination
Basically, I am running one exe file using execFile method from the child process...
That exe file used ffmpeg for some conversion... If ffmpeg throws some error (Basically it won't affect the actual ...
1
vote
0
answers
37
views
FFMPEG - gdigrab startup delay with nodejs child_process
I am using the following command for screen recording:
ffmpeg -rtbufsize 100M -f gdigrab -framerate 5 -probesize 10M -draw_mouse 1 -show_region 0 -i desktop -y -c:v libx264 -r 5 -tune zerolatency -g ...
0
votes
0
answers
16
views
Error executing a child process in nodejs with a long path
I am using nodejs adn I have to execute a child_process with a long path in windows 8.1.
I am getting an error because the path length is too long.
const { exec, spawn } = require("child_process&...
-1
votes
1
answer
38
views
Child process exited with code 1 LibGDX jPackageImage task
I am using jpackage to convert my libgdx game to an executable file. I am following this tutorial to do so. The jpackageImage task works perfectly fine but when the exe is created and I run it, it ...
0
votes
0
answers
32
views
Processes getting exited with exit code 145 in parallel processing(unix)
I am using the following code snippet for handling the child processes :
res=0
handle_chld() {
local tmp=()
for i in ${!pids[@]}; do
if [ ! -d /proc/${pids[i]} ]; then
wait ${pids[i]}
...
1
vote
0
answers
18
views
How to avoid looping expect when asserting on stdout from child
I'm trying to write an integration test in Jest with TypeScript for a logging utility that has some logic and wraps Gulp Fancy Log. I can't use Jest's spyOn with console (no stdout event occurs on the ...
1
vote
1
answer
36
views
How can I respond to a prompt in Node.JS child process
I'm trying to write a program that runs a series of commands as my other user account, which is an administrator, however I'm running into an issue where the "Please enter the password" part ...
0
votes
0
answers
15
views
Detect pm2 process complete programmatically
I've that following pm2 start code, it runs a basic process in 1.js which takes 5 seconds to complete, but after it completed how can I detect that the process is finished in my main js file to take ...
0
votes
0
answers
13
views
How to synchronously read from stdin when spawning a process in NodeJS?
I use NodeJS 16 and the function child_process.spawn to start a process. The callee spits out data after each input per line.
Example:
ping <--- stdin by caller
pong <--- stdout by callee
ping &...
0
votes
0
answers
18
views
Permission issue when running a python script via Node spawn child process
I have a Node application, one function of which involves executing a python script. The python script processes some data in a file, and then writes parsed data to a new sample.json file.
Then Node ...
-1
votes
0
answers
71
views
Error Code 0xc0000142 starting process using from Windows Service
I am seeing the following 0xc0000142 error in the Control Panel Event log on a Windows Server 2016 machine:
This 0xc0000142 error is happening in the following scenario on a Windows Server 2016 ...
0
votes
0
answers
12
views
how to keep particular child process out of parent process's cgroup limit
I have a process, set a timer to run some dynamic scripts to scrape data, each of those scripts run as a sub-process of my process. And I set cgroup limit to my process to limit cpu/mem, intend to ...
0
votes
0
answers
54
views
VUE2 + Electron + Flask -> Python not spawning on build
I've just finished my first vue+electron+flask project and I am having quite a hard time trying to package it. Everything is workig "perfectly" when using "npm run electron:serve" ...
0
votes
0
answers
16
views
How to check whether the command you passed in os.system() has completed?
I have written a python script to generate heatmap but i can't detect when the system call completes its execution.
import os
import sys
#TEST_CONFIG_JSON = "config.json"
#TEST_IMAGE = &...
1
vote
1
answer
33
views
Trying to execute command from Nodejs (exec) throw error but works in terminal
I'm trying to run this script
let { exec } = require("child_process");
let command =
"reg add 'HKCU\\SOFTWARE\\MySoftware' /v 'LOADER' /t REG_SZ /d 'C:\\Program Files\\MyCompany\\some.dll' /f";
...
3
votes
0
answers
42
views
Node js - best approach to create many child processes
I have a main nodejs application that loops over a list of websites and creates a child process for each website to gather information from that site (scraping).
my problem is that I may have many ...
0
votes
0
answers
29
views
Child process spawn EBUSY error in nodejs?
I am running a child process using the following code but facing an issue.
fs.writeFile(bat_filePath, str_to_write, 'utf8', function (err) {
if (err) {
console.log(err);
callback({...
0
votes
0
answers
16
views
will running a js file from node modules work after bundling the project into exe?
->root
->folders...
->src
->node_modules
->package.json
->index.ts
->node_modules
->package.json
This is my project directory.
In index.ts
import { fork } ...
-1
votes
0
answers
34
views
ffmpeg concat clears file and throws error: Invalid data found when processing input
I'm trying to merge two audio tracks (one after the other one) and i use this command:
ffmpeg -f concat -safe 0 -i ./temp/speech/afiles.txt -c copy ./temp/audio.mp3
./temp/speech/afiles.txt contains ...
1
vote
1
answer
19
views
How should I rewrite code in order to create two child processes each of which execs childtest.c from parent process
I want to rewrite forkexetest.c to create two child processes, each of which execs childtest.
However, do not have more than three child processes.
How should I rewrite it.
forkexetext.c
#include <...
1
vote
0
answers
17
views
Node child_process with ISO-8859-1 in command line
There is a way to exec shell command in nodeJs with ISO-8859-1;
It seems that nodeJs always force the UTF-8 when use child_process
0
votes
0
answers
25
views
Don't wait for long running child process on server kicked off via PHP in browser
I have before me a PHP function that wants to kick off a long-running child process. The user of the web-page doesn't need see the result of the long running process. Currently the code uses backticks ...
0
votes
0
answers
12
views
How do I properly finish the connection from my pseudo-terminal to real-terminal (powershell) using node-pty?
I'm having some hard time to finish this connection properly. How am I supposed to do that? i've tried using kill() but it give the following error:
node:internal/modules/cjs/loader:943 ...
0
votes
1
answer
52
views
Error handling using child_process.execSync in NodeJs
This is my NodeJs snippet:
const {execSync} = require('child_process');
testoutput = execSync('make test');
Here I am getting stdout as output to testoutput variable from the execSync process if ...
0
votes
1
answer
24
views
How do I pass a variable to a child widget?
I am passing a string value `final String userLogin; from another file via Route.
class AutfPasswordWidget extends StatefulWidget {
final String userLogin;
AutfPasswordWidget({Key? key, ...
0
votes
0
answers
37
views
Node.js/child_process: I am having trouble successfully killing a given process to allow me to delete the given directory
The following code is meant to kill a given process and allow me to remove a directory and update it:
private async updateRepo(): Promise<void> {
try {
log.standard("...
0
votes
0
answers
28
views
How to handle stdout cursor movements in child process in Node.js?
I'm spawning a child process in Node.js and logging that process's stdout and stderr as per the docs' example here: https://nodejs.org/docs/latest-v16.x/api/child_process.html#child-process. I'm ...
0
votes
1
answer
53
views
Can a child process know how many additional file descriptors are expected?
I have a situation where a parent is spawning a process with some dynamic number of additional stdio pipes, as so:
const child = spawn("something", [], { stdio:["pipe", "pipe&...
1
vote
2
answers
31
views
Child process not killed - Node js ( inside Electron js app, windows)
I am trying to stop this command after 4 seconds, but it doesn't stop the child-process
(Running in an electron-js app, windows )
child = child_process.spawn("ping google.com -t", {
...
0
votes
0
answers
24
views
Does fork need node js to be installed if its bundled into an application
const fork = fork('dummy.js');
my application uses this line to execute a js file as a child process.
Now my question is that what if I bundle into my electron application and run it in a system that ...
0
votes
0
answers
28
views
Need to run Jest from JavaScript code and write result to json
Ho to run Jest from JavaScript code and write result to json?
From terminal it would look like:
jest /folder/task.test.js --json --outputFile=result.json and i need to execute it inside javascript ...
0
votes
0
answers
20
views
Implement chunk buffer size input
I try to implement chunk stream output, in this case, it is a video file with 640x360, 7070 Frame, rbg32 (r,g,b,a). so stream length will be 6515712000. i cap stream output to 1 frame = 921600 stream ...
0
votes
2
answers
81
views
How to use promisify() with the spawn() function for the 'child_process'?
I have the following code example, and I have now ideas on how to resolve this using utils.promisify(); ONLY! Not Promise!
const spawn = child_process.spawn('docker', ['--version']);
spawn.stdout.on('...
2
votes
1
answer
47
views
Error "No such device or address" from child_process.exec, pipe helps. Why?
I'm using child_process.exec to execute various quilt commands and capture their output. This works fine so far for all commands except for quilt graph. which results in an error "No such device ...
0
votes
0
answers
15
views
Executing a child process within an async await function under an Express JS route [duplicate]
I am trying to run an async/await operation to create a new record of a model named Log. I carried out this operation within my child process exec function, but for some reason, the operation does not ...
0
votes
0
answers
28
views
Node Js--Child_process exec/execFile/Spawn is not opening exe/bat file after deployment from angular application
Here the requirement is to open the exe file from browser on button click.
This is the internal application, so client(angular) and server(node.js) is present in all machines, so here the idea is that,...
1
vote
1
answer
42
views
How to pass variable in child_process and access the variable in child process in nodejs
Code for parent.js
const {spawn} = require("child_process");
const encodeImage = (req,res)=>{
try {
const path = req.file.path;
let dataToSend;
const python =...
0
votes
0
answers
14
views
Alpine image special user able to remove a file for which he doesn't have permission to write in [duplicate]
I created a special user inside of my docker container :
RUN addgroup -g 1600 -S restrictedusergroup
RUN adduser -h /home/restricteduser -u 1500 -G restrictedusergroup -S restricteduser
Now when I ...
1
vote
1
answer
33
views
why I'm getting different outputs in different devices of the same code of the child_process's fork method in nodejs?
Main I have two files, one is the parent file and another one is the child file.
I tested in two different systems one mac os monastery and another one is dell -
ubuntu 20., In both systems, I'm ...
0
votes
1
answer
42
views
Executing child process in express js route
I am trying to run a simple child process in my express js route and return a json message with the stdout as the message value.
But for some reason the stdout value is undefined any pointers?
express ...
2
votes
1
answer
87
views
Python multiprocess: run several instances of a class, keep all child processes in memory
First, I'd like to thank the StackOverflow community for the tremendous help it provided me over the years, without me having to ask a single question.
I could not find anything that I can relate to ...