From dc2e68f0f25a3a7b9d887d597508d75e8c2b3972 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 24 Jul 2019 18:44:24 -0400 Subject: [PATCH] revert --- .../src/processes/processLauncher.js | 124 +----------------- 1 file changed, 1 insertion(+), 123 deletions(-) diff --git a/packages/embark-core/src/processes/processLauncher.js b/packages/embark-core/src/processes/processLauncher.js index e47261198..c023ec85b 100644 --- a/packages/embark-core/src/processes/processLauncher.js +++ b/packages/embark-core/src/processes/processLauncher.js @@ -1,126 +1,4 @@ const child_process = require('child_process'); -<<<<<<< HEAD -const EventEmitter = require('events'); - -class ProcessLauncher extends EventEmitter { - constructor(embark, options) { - super(); - - this.embark = embark; - - this.name = options.name; - this.command = options.command; - this.args = options.args || []; - this.splitLines = !!options.splitLines; - } - - start() { - if (this.child) { - throw new Error('child process already started'); - } - - const stdioHandler = (chunk, fd) => { - const ev = `output:${fd}`; // output:stdout, output:stderr - - if (!this.splitLines) { - return this.emit(ev, chunk.toString()); - } - - const lines = chunk.toString().trim().split("\n"); - for (const l of lines) { - this.emit(ev, l); - } - }; - - const child = child_process.spawn( - this.command, - this.args, - { - detached: true, - stdio: ['pipe', 'pipe', 'pipe'], - windowsHide: true - } - ); - - child.on('error', (err) => { - // Make sure we have listeners for errors. If not, we should throw - // an error to make sure the operator handles it next time. - const listeners = this.listeners('error'); - if (listeners.length === 0) { - throw err; - } - - this.emit('error', err); - }); - - child.on('exit', (code) => this.emit('exit', code)); - child.stdout.on('data', chunk => stdioHandler(chunk, 'stdout')); - child.stderr.on('data', chunk => stdioHandler(chunk, 'stderr')); - - this.child = child; - - // Ensure we kill child processes when SIGINT is signaled. - process.on('SIGINT', () => process.exit(0)); - process.on('exit', () => child.kill('SIGINT')); - } - - send(buf) { - if (!this.child) { - throw new Error('child process not started or killed'); - } - - this.child.stdin.write(buf); - } - - stop() { - if (!this.child) { - throw new Error('child process not started or killed'); - } - - const child = this.child; - this.child = null; - - child.kill('SIGINT'); - } -} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -======= ->>>>>>> parent of 2beeaa68... process launching code const constants = require('../../constants'); const path = require('path'); const ProcessLogsApi = require('embark-process-logs-api'); @@ -184,7 +62,7 @@ export class ProcessLauncher { return self.exitCallback(code); } if (code) { - self.logger.info(`Child Process ${this.name} exited with code ${code}`); + this.logger.info(`Child Process ${this.name} exited with code ${code}`); } }); }