mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
测试:judger封装为模块
This commit is contained in:
1 parent
5d7f57334f
commit
6134a16f8c
8 files changed
+305
-30
No files matched your search
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "sandbox-linux",
|
||||
"version": "1.0.0",
|
||||
"os": "Linux",
|
||||
"description": "Sandbox service for linux"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
const os = require('os');
|
||||
const child = require('child_process');
|
||||
|
||||
const p = child.spawn(path.resolve(os.tmpdir(), 'hydro', 'sandbox-linux', '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 };
|
||||
Reference in new issue
Block a user