-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexec.js
More file actions
31 lines (24 loc) · 722 Bytes
/
exec.js
File metadata and controls
31 lines (24 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var spawn = require('child_process').spawn;
var compile = spawn('gcc', ['temp.c']);
compile.stdout.on('data', function (data) {
console.log('stdout: ' + data);
});
compile.stderr.on('data', function (data) {
console.log(String(data));
});
compile.on('close', function (data) {
// console.log('stdout: ' + data);
if (data === 0) {
var run = spawn('./a.exe', []);
run.stdout.on('data', function (output) {
console.log(String(output));
});
run.stderr.on('data', function (output) {
console.log(String(output));
});
run.on('close', function (output) {
console.log('stdout: ' + output);
})
} else {
}
})