From 700c728b28f65c246f0851566e366dfdf10706b8 Mon Sep 17 00:00:00 2001 From: nuintun Date: Thu, 14 Jan 2016 10:07:08 +0800 Subject: [PATCH] update files --- bin/child-thread.js | 64 --------------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 bin/child-thread.js diff --git a/bin/child-thread.js b/bin/child-thread.js deleted file mode 100644 index ebc00ee..0000000 --- a/bin/child-thread.js +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Created by nuintun on 2015/12/4. - */ - -'use strict'; - -var Emulator = require('./emulator'); - -var emulator; - -// thread -process.on('message', function (message){ - if (message.action === 'stop') { - if (emulator) { - emulator.stop(); - } - - process.exit(); - - return; - } - - if (message.action === 'start') { - var stream; - var project = message.project; - - if (emulator) { - emulator.stop(); - } - - emulator = new Emulator({ - cwd: project.path, - command: project.command.value - }); - - stream = emulator.start(); - - stream.stdout.on('data', function (data){ - process.send({ - event: 'data', - project: project, - data: data.toString() - }); - }); - - stream.stderr.on('data', function (error){ - emulator.stop(); - process.send({ - event: 'error', - project: project, - data: error.toString() - }); - }); - - stream.on('close', function (signal){ - emulator.stop(); - process.send({ - event: 'close', - project: project, - data: signal.toString() - }); - }); - } -});