You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
660 B
JavaScript
25 lines
660 B
JavaScript
5 years ago
|
const os = require('os');
|
||
5 years ago
|
const path = require('path');
|
||
5 years ago
|
const child = require('child_process');
|
||
|
|
||
5 years ago
|
const p = child.spawn(path.resolve(os.tmpdir(), 'hydro', 'sandbox-linux-amd64', 'executorserver', ['-silent']));
|
||
5 years ago
|
if (!p.stdout) throw new Error('Cannot start executorserver');
|
||
|
else {
|
||
|
p.stdout.on('data', (data) => {
|
||
|
const s = data.toString();
|
||
|
console.log(s.substr(0, s.length - 1));
|
||
|
});
|
||
|
p.stderr.on('data', (data) => {
|
||
|
const s = data.toString();
|
||
|
console.log(s.substr(0, s.length - 1));
|
||
|
});
|
||
|
}
|
||
|
p.on('error', (error) => console.error(error));
|
||
|
|
||
|
async function stop() {
|
||
|
p.emit('exit');
|
||
|
}
|
||
|
|
||
|
|
||
|
module.exports = { stop };
|