-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmain.js
41 lines (37 loc) · 1.03 KB
/
main.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
const electron = require("electron");
const BrowserWindow = electron.BrowserWindow;
const app = electron.app;
const Menu = electron.Menu;
const MenuItem = electron.MenuItem
let win
function createWindow () {
win = new BrowserWindow({ width: 1000, height: 700, icon: __dirname + 'icon/icon.ico'})
win.setMenu(null)
win.loadFile('index.html')
win.on('closed', () => {
win = null
})
}
app.on('ready', createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'windows') {
//var myBatFilePath = "stop.bat";
//const spawn = require('child_process').spawn;
//const bat = spawn('cmd.exe', ['/c', myBatFilePath]);
const exec = require('child_process').exec;
exec('taskkill /F /IM php.exe', (e, stdout, stderr)=> {
if (e instanceof Error) {
console.error(e);
throw e;
}
console.log('stdout ', stdout);
console.log('stderr ', stderr);
});
app.quit()
}
})
app.on('activate', () => {
if (win === null) {
createWindow()
}
})