-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
45 lines (29 loc) · 985 Bytes
/
index.js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
var path = require("path")
const { exec } = require('child_process');
var child_process = require('child_process');
/*
const selectPort = () => {
pyPort = 88884
return pyPort
}
const createPyProc = () => {
let port = '' + selectPort()
let script = path.join(__dirname, "kk.py")
pyProc = require('child_process').spawn('python', [script, port])
if (pyProc != null) {
console.log('child process success')
}
pyProc.stdout.on('data', function (data) {
console.log('标准输出:' + data);
});
}
createPyProc()
*/
//let script = path.join(__dirname, "./dist/kk.exe")
//var pyProc = require('child_process').execFile(script)
let script = path.join(__dirname, "kk.py")
pyProc = require('child_process').spawn('python', [script])
pyProc.stdout.on('data', function (data) {
console.log('output from cmd:' + data);
});
//etInterval(function(){console.log('child process success')},1000)