child-process

Excute command in gulp for sub folder

爱⌒轻易说出口 提交于 2020-02-05 06:55:48
问题 My project is structured as follows: myapp -server.js -test --testcontent ---package.json -package.json I have two package.json files and I want to run npm install on the package.json inside the testcontent folder. If in the command line I go to myapp/test/testcontent and run npm install it works and it creates a new folder node_modules with the dependencies from the correct package.json . How can that be done from within gulp? I tried the following but it uses the package.json in myapp not

Node.js as service, exec doesn't work

我只是一个虾纸丫 提交于 2020-02-03 10:54:05
问题 I'm running Node.js project as service using nssm. When user clicks button on my nodejs website it should run require('child_process').exec('cmd /c batfile.bat', function({ res.send(somedata); }); but instead it just skips running bat file and jumps to res.send(somedata) . Why is that? When I run Node.js using cmd and npm start server.js it works fine. How can I make exec work while running nodejs as service? Edit, some code: require('child_process').exec('cmd /c batfile.bat', function(){ var

Require('child_process') => cannot find Require / child_process + launch .bat

a 夏天 提交于 2020-01-30 10:59:46
问题 It has been 3 days I'm searching on forums a way to make work my program, and it still doesn’t work… I'm working on my first AngularJS project , and I need to launch an external program when the user clicks on an image. I have a module named tool-list, and in my tool-list.component.ts, I export a class named ToolListComponent. In this class I have my function to launch my external program. launchtool(){ alert("I'm trying to launch test.bat!"); const spawn = require('child_process').spawn; /

Require('child_process') => cannot find Require / child_process + launch .bat

北战南征 提交于 2020-01-30 10:58:11
问题 It has been 3 days I'm searching on forums a way to make work my program, and it still doesn’t work… I'm working on my first AngularJS project , and I need to launch an external program when the user clicks on an image. I have a module named tool-list, and in my tool-list.component.ts, I export a class named ToolListComponent. In this class I have my function to launch my external program. launchtool(){ alert("I'm trying to launch test.bat!"); const spawn = require('child_process').spawn; /

Child_process handling a STDOUT stream with carriage return (\r)

送分小仙女□ 提交于 2020-01-24 15:12:28
问题 I'm writing a simple(ish) application that allows an internal system at work to request a copy process (using rsync) from a remote server to another remote server instigated using a REST call. I'm already familiar enough with the express framework, and have just started experimenting with the child_process library, and stumbled upon a small problem. I am successfully starting rsync processes using node's childProcess.spawn() , my issue is that rsync outputs its progress line-buffered with a

Running a node.js script every 10 seconds

被刻印的时光 ゝ 提交于 2020-01-23 08:00:33
问题 I just started using Node.js and I'm now trying to make my script run in the background every 10 seconds like a daemon waiting for something to do, when there is something to run from the database It reads the output from the program and does certain tasks depending on the output. This is what I've been able to do so far, It works just as I intended but can only run once even in the background. How can I make it run like a daemon every 10 seconds? Code: var spawn = require('child_process')

Retrieve bash error from NodeJS child_process.spawn

泪湿孤枕 提交于 2020-01-16 06:11:30
问题 When I execute the (made up and ridiculous) command banana from bash I get the following error: bash: banana: command not found But if I execute banana in a child_process.spawn in Node.js, I get the error: net.js:624 throw new TypeError('invalid data'); ^ TypeError: invalid data at WriteStream.Socket.write (net.js:624:11) at ChildProcess.<anonymous> at ChildProcess.emit (events.js:107:17) at Process.ChildProcess._handle.onexit (child_process.js:1065:12) at child_process.js:1137:20 at process.

Retrieve bash error from NodeJS child_process.spawn

大兔子大兔子 提交于 2020-01-16 06:11:04
问题 When I execute the (made up and ridiculous) command banana from bash I get the following error: bash: banana: command not found But if I execute banana in a child_process.spawn in Node.js, I get the error: net.js:624 throw new TypeError('invalid data'); ^ TypeError: invalid data at WriteStream.Socket.write (net.js:624:11) at ChildProcess.<anonymous> at ChildProcess.emit (events.js:107:17) at Process.ChildProcess._handle.onexit (child_process.js:1065:12) at child_process.js:1137:20 at process.

node.js - reading child process stdout 100 bytes at a time

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-16 04:31:08
问题 I'm spawning a child that produces lots of data (I'm using 'ls -lR /' here as an example). I want to asynchronously read the child's stdout 100 bytes at a time. So I want to do: get100().then(process100).then(get100).then(process100).then(... For some reason, this code only loops 3 times and I stop getting Readable events. I can't figure out why? var Promise = require('bluebird'); var spawn = require("child_process").spawn; var exec = spawn( "ls", [ "-lR", "/"] ); var get100 = function () {

Wait for all child processes of a ran process to finish C#

社会主义新天地 提交于 2020-01-16 01:27:10
问题 I'm developing a Launcher application for games. Much like XBOX Dashboard in XNA. I want to open back my program when the process which it started(the game) exits. With a simple game this is working: [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] static extern bool SetForegroundWindow(IntPtr hWnd); [DllImportAttribute("User32.DLL")] private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); private const int SW_SHOW = 5; private const int SW_MINIMIZE = 6; private