mirror of
https://github.com/enso-org/enso.git
synced 2024-12-23 21:01:51 +03:00
Handling exceptions in IDE main to avoid entering "zombie process" state. (#3648)
This is meant to address https://www.pivotaltracker.com/story/show/182691027.
This commit is contained in:
parent
0dbbbaad00
commit
6c82588972
@ -54,6 +54,9 @@
|
|||||||
methods, atoms and functions are presented in nice, categorized view. The most
|
methods, atoms and functions are presented in nice, categorized view. The most
|
||||||
popular tools are available at hand. The The panel is unstable, and thus is
|
popular tools are available at hand. The The panel is unstable, and thus is
|
||||||
available under the `--enable-new-component-browser` flag.
|
available under the `--enable-new-component-browser` flag.
|
||||||
|
- [Fixed error handling during startup.][3648] This prevents entering IDE into a
|
||||||
|
"zombie" state, where processes were started but not visible to user. They
|
||||||
|
could cause issues with starting further IDE instances.
|
||||||
|
|
||||||
#### EnsoGL (rendering engine)
|
#### EnsoGL (rendering engine)
|
||||||
|
|
||||||
@ -273,6 +276,7 @@
|
|||||||
[3601]: https://github.com/enso-org/enso/pull/3601
|
[3601]: https://github.com/enso-org/enso/pull/3601
|
||||||
[3617]: https://github.com/enso-org/enso/pull/3617
|
[3617]: https://github.com/enso-org/enso/pull/3617
|
||||||
[3629]: https://github.com/enso-org/enso/pull/3629
|
[3629]: https://github.com/enso-org/enso/pull/3629
|
||||||
|
[3648]: https://github.com/enso-org/enso/pull/3648
|
||||||
|
|
||||||
#### Enso Compiler
|
#### Enso Compiler
|
||||||
|
|
||||||
|
@ -476,27 +476,46 @@ let mainWindow = null
|
|||||||
let origin = null
|
let origin = null
|
||||||
|
|
||||||
async function main(args) {
|
async function main(args) {
|
||||||
runBackend()
|
// Note [Main error handling]
|
||||||
console.log('Starting the IDE service.')
|
try {
|
||||||
if (args.server !== false) {
|
runBackend()
|
||||||
let serverCfg = Object.assign({}, args)
|
|
||||||
serverCfg.dir = root
|
console.log('Starting the IDE service.')
|
||||||
serverCfg.fallback = '/assets/index.html'
|
if (args.server !== false) {
|
||||||
server = await Server.create(serverCfg)
|
let serverCfg = Object.assign({}, args)
|
||||||
origin = `http://localhost:${server.port}`
|
serverCfg.dir = root
|
||||||
}
|
serverCfg.fallback = '/assets/index.html'
|
||||||
if (args.window !== false) {
|
server = await Server.create(serverCfg)
|
||||||
console.log('Starting the IDE client.')
|
origin = `http://localhost:${server.port}`
|
||||||
mainWindow = createWindow()
|
}
|
||||||
mainWindow.on('close', evt => {
|
if (args.window !== false) {
|
||||||
if (hideInsteadOfQuit) {
|
console.log('Starting the IDE client.')
|
||||||
evt.preventDefault()
|
mainWindow = createWindow()
|
||||||
mainWindow.hide()
|
mainWindow.on('close', evt => {
|
||||||
}
|
if (hideInsteadOfQuit) {
|
||||||
})
|
evt.preventDefault()
|
||||||
|
mainWindow.hide()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
// Note [Main error handling]
|
||||||
|
console.error('Failed to setup IDE. Error:', err)
|
||||||
|
Electron.app.quit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Note [Main error handling]
|
||||||
|
// ==========================
|
||||||
|
// It is critical that the main function runs in its entirety. Otherwise, IDE enters a "zombie
|
||||||
|
// process" state, where Electron processes have been spawned, but there is no window and user can't
|
||||||
|
// observe anything. Usually they will try to spawn another instance of the IDE, but this can fail
|
||||||
|
// because of these zombie process presence.
|
||||||
|
//
|
||||||
|
// The solution is to catch all errors and exit the process if any part of the initial setup fails.
|
||||||
|
// If it succeeds, at least the Window will be shown, allowing the user to observe the error and
|
||||||
|
// close it.
|
||||||
|
|
||||||
function urlParamsFromObject(obj) {
|
function urlParamsFromObject(obj) {
|
||||||
let params = []
|
let params = []
|
||||||
for (let key in obj) {
|
for (let key in obj) {
|
||||||
|
Loading…
Reference in New Issue
Block a user