Questions tagged [child-process]

If you have any inquiries about child-process, please do not hesitate to reach out.

obtain the node variable within a React component

Starting an electron app using https://github.com/electron-react-boilerplate/electron-react-boilerplate Utilizing child_process from node like : function func() { spawn('powershell.exe', ["ls"], (error, stdout, stderr) => { if (error) { ...

The second node child process encounters execution issues in Linux

For a challenge, I needed to find a way to automatically restart my bot within itself. After some trial and error, I came up with a solution. However, when testing on a Raspberry Pi via ssh, the process exits after the first child process ends. Surprisingl ...

Encountering an error when attempting to add the 'shelljs' module to an Angular 2 TypeScript project

I am facing an issue with including the shelljs library in my Angular 2 TypeScript project. I have already added the shelljs.d.ts file to the node_modules/shelljs directory. Below is my package.json configuration: "name": "myproj1", "description": "myp ...

Check the output of the ChildProcess after executing a shell command

I am currently running the ChildProcess function within a Nextjs API route and I am struggling to retrieve the value from it. const output = exec( "curl -s -v https://test.com/index.php", (err, stdout, stderr) => { if (err) { ...

Is it possible to execute a node child process with a node script directly from a buffer instead of from a separate file?

At the moment, I am creating a node script in a string/buffer within a parent node script. Subsequently, I write the generated script to a file and then execute that file in a child process. Once completed, I delete the temporary script file. Below is a b ...

Avoid idle time in nodejs spawned processes

I am currently utilizing child_process.spawn to run an application and I need to perform certain actions after the app has been started. However, I have noticed that spawn is causing the main process to get blocked. const spawnAsync = Promise.promisify(re ...

Looking to get an object from a child process's stdout?

I am working on running a process on a different instance than the Node server. To achieve this, I have created a loop and executed the child_process. The data retrieved from the child_process is in object format as shown below. { data: [], status: 'acti ...

Using Node.js to Send Ctrl+C to a Child Process in a Windows Environment

Hey there, I've been using child_process.spawn to launch a child process that runs a Python script on my Windows machine. The Python script listens for SIGINT to gracefully exit itself, but unfortunately Windows doesn't support signals and Node j ...

Tips for closing the stdio pipes of child processes in node.js?

Looking to spawn a child process from node.js and monitor its stdout before closing the pipe to terminate the node process. Here's my base code snippet that is currently not ending the node process: const childProcess = require("child_process"); const ch ...

What is the best way for a parent process to interrupt a child_process using a command?

I'm currently in the process of working on a project that involves having the user click on an 'execute' button to trigger a child_process running in the backend to handle a time-consuming task. The code snippet for this operation is shown b ...

I am interested in redirecting command line output to a file rather than displaying it in the standard

Is it possible to use child-process and spawn in node.js to execute a command and save the output to a file instead of displaying it on the standard output? test.js const expect = require('chai').expect; const { spawn } = require('child_process') let pat ...

Executing a cURL request using Node.js

Looking for assistance in converting the request below: curl -F <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1a777f7e737b275a73777b7d7f34706a7d">[email protected]</a> <url> to an axios request if possible. ...

Running a child process within a React application

I'm currently in search of the best module to use for running a child process from within a React application. Here's what I need: I want a button that, when clicked, will execute "npm test" for my application and generate a report that can be rendered ac ...

Running a child process within an express js route

I have a problem where I am trying to execute a child process within my Express JS route and then return a JSON message with the output of this process as the message value. However, I am currently experiencing an issue where the stdout value is coming bac ...

Unlocking the WiFi Security Key and Accessing Connected Devices with Javascript

When utilizing the command line netsh wlan show interfaces, it displays various information. However, I am specifically interested in extracting the data Profile : 3MobileWiFi-3D71. My goal is to retrieve only the content after the : so that ...

React JS integrated with Stripe

I am in need of generating a token with Stripe.js within a React JS environment, however, I have been unable to find a straightforward solution. In a node.js setting, the process would typically look something like this: stripeClient.tokens.create({ ...

What is the process for running child_process when a user clicks on a view in an application

Just starting out with Node.js and utilizing express along with hogan or moustache templating for my views. I've successfully used the following code in my routing files, index.js as shown below: /* Test Shell Execute. */ router.get('/shell', function(re ...

The callback response in Node's exec function is behaving incorrectly

When I have a route handling a URL post request, I am running an exec on a bash command. Strangely, the console.log is working fine indicating that the bash command ends and the callback is triggered. However, for some reason, the response fails to send ...

The node fails to send a response once the child process has terminated

I am currently implementing a route that involves downloading Sentinel data. Below is the code snippet for the route: app.get('/downloadSentinel', function (req,res){ var promObj = {}; var data = req.query.data; var Name = req.query.name; namesArray = []; ...

When initiating a new process with exec() in nodejs, is it executed concurrently with the current process? How does nodejs manage this situation?

Given that nodejs operates on a single thread, how exactly does it go about creating and managing new processes? const exec = require('child_process').exec; exec('my.bat', (err, stdout, stderr) => { if (err) { console.er ...

Executing a task utilizing a designated child process in Node.js

Although I'm familiar with forking a child process, my specific requirement involves using this child process to perform certain tasks. For instance, when clicking a button, I need the child process to handle processing form data for saving. This hand ...

Problem with spawning Python when using VUE2, Electron, and Flask

After completing my first project using Vue, Electron, and Flask, I am encountering difficulties packaging it. While everything works perfectly with "npm run electron:serve," there seems to be an issue when running "npm run electron:build" as Flask is not ...

NodeJS - leveraging forked processes on a single virtual machine with multiple processors versus the utilization of multiple virtual machines running a single process

In my NodeJS development project, I am working on a service that generates text files from images using a node wrapper for the tesseract OCR engine. The goal is to have this service running continuously, starting and restarting (in case of a crash) using u ...

Having trouble creating a custom .exe file using express.js on Windows platform

When a user uploads an image from their phone, I use node.js/express.js on Windows to run myApp.exe for openCV image processing. The output images are saved to a specified directory as an argument in the command below. Executing this command through child ...

Ways to terminate a running child process in npm

Within my package.json file, I have a debug script that launches a Node application. This entire NPM script is initiated by a test, and this test must terminate the debug script once it completes. When I use npm run debug and try to kill the process, the ...

Can dotnet exe be run on Linux using a Node.js child process?

I have an executable file that was created using dotnet. I have a server running rhc where I need to run this exe and capture its output using child-process. However, I am encountering the following error: cannot execute binary file I understand that i ...

Facing difficulties in initiating Selenium with PhantomJS/GhostDriver as child processes

I am currently working on a Node script that involves using the child_process module in order to run a Selenium server with PhantomJS's GhostDriver. I have imported the module: Child = require "child_process" This is how I am attempting to start the ...

Live feed of Npm child processes

I'm currently developing a command-line tool for a node.js application that requires running npm commands and displaying the results. Here's what I've come up with so far: import {spawn} from 'child_process'; let projectRoot = &a ...