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.
Hydro/module/sandbox-linux-amd64/service.js

25 lines
660 B
JavaScript

const os = require('os');
const path = require('path');
const child = require('child_process');
const p = child.spawn(path.resolve(os.tmpdir(), 'hydro', 'sandbox-linux-amd64', 'executorserver', ['-silent']));
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 };