launcher; restore default log methods when closed to avoid errors
This commit is contained in:
parent
f0747c5e8f
commit
6ee68b0b6c
2 changed files with 25 additions and 18 deletions
|
|
@ -1,5 +1,10 @@
|
|||
# Changelog
|
||||
|
||||
## 0.49.3
|
||||
|
||||
- bug fixes
|
||||
- error when closing the launcher window and keeping the client window alive
|
||||
|
||||
## 0.49.2
|
||||
|
||||
- bug fixes
|
||||
|
|
|
|||
|
|
@ -100,31 +100,33 @@ if (settings.cli) {
|
|||
global.settings = settings
|
||||
global.midilist = require('./midi').list
|
||||
launcher = require('./electron-window')({address:address, shortcuts:dev, width:680, height:(100 + 8*3 + 29 * Object.keys(settings.options).filter(x=>settings.options[x].launcher !== false).length), node:true, color:'#253040'})
|
||||
launcher.on('close', ()=>{
|
||||
process.stdout.write = stdoutWrite
|
||||
process.stderr.write = stderrWrite
|
||||
if (process.log) process.log = processLog
|
||||
})
|
||||
})
|
||||
|
||||
if (process.log) {
|
||||
process.log = (function(write) {
|
||||
return function(string, encoding, fd) {
|
||||
write.apply(process, arguments)
|
||||
launcher.webContents.send('stdout', string)
|
||||
}
|
||||
})(process.log)
|
||||
}
|
||||
let processLog = process.log,
|
||||
stdoutWrite = process.stdout.write,
|
||||
stderrWrite = process.stderr.write
|
||||
|
||||
process.stdout.write = (function(write) {
|
||||
return function(string, encoding, fd) {
|
||||
write.apply(process.stdout, arguments)
|
||||
if (process.log) {
|
||||
process.log = function(string, encoding, fd) {
|
||||
processLog.apply(process, arguments)
|
||||
launcher.webContents.send('stdout', string)
|
||||
}
|
||||
})(process.stdout.write)
|
||||
}
|
||||
|
||||
process.stderr.write = (function(write) {
|
||||
return function(string, encoding, fd) {
|
||||
write.apply(process.stdout, arguments)
|
||||
launcher.webContents.send('stderr', string)
|
||||
}
|
||||
})(process.stderr.write)
|
||||
process.stdout.write = function(string, encoding, fd) {
|
||||
stdoutWrite.apply(process.stdout, arguments)
|
||||
launcher.webContents.send('stdout', string)
|
||||
}
|
||||
|
||||
process.stderr.write = function(string, encoding, fd) {
|
||||
stderrWrite.apply(process.stderr, arguments)
|
||||
launcher.webContents.send('stderr', string)
|
||||
}
|
||||
|
||||
ipcMain.on('start',function(e, options){
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue