diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-07-02 06:29:58 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-07-02 06:29:58 +0200 |
| commit | be26f182ccdff4f96c52d419deebee4aff055e18 (patch) | |
| tree | 227399a1a20de01e00d1a524be0c3875a2defcca /lib/bridge/monitor.js | |
| parent | 22735b5dcb3503b5575d77bb066159f623e60f9e (diff) | |
worker in own process
Diffstat (limited to 'lib/bridge/monitor.js')
| -rw-r--r-- | lib/bridge/monitor.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/bridge/monitor.js b/lib/bridge/monitor.js new file mode 100644 index 0000000..d8d29ef --- /dev/null +++ b/lib/bridge/monitor.js @@ -0,0 +1,19 @@ +class Monitor { + constructor(args) { + const cmd = spawn(process.env.PYTHON_BINARY, args); + + let stdout = '', stderr = '' + + cmd.stdout.on('data', (data) => { + this.stdout += data + }) + + cmd.stderr.on('data', (data) => { + this.stderr += data + }) + + cmd.on('exit', function (code) { + exit && exit( data.toString() ) + }) + } +} |
