mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-16 10:15:02 -06:00
SDA-4386 (Properly terminate c9 shell on exiting the application) (#2012)
* SDA-4386 - Properly terminate c9 shell on exiting the application * SDA-4386 - Wait for the C9 process to terminate
This commit is contained in:
parent
ee7ce7d5a5
commit
4611f66143
@ -77,7 +77,7 @@ class C9ShellHandler {
|
||||
/**
|
||||
* Terminates the c9shell process if it was started by this handler.
|
||||
*/
|
||||
public terminateShell() {
|
||||
public terminateShell = async () => {
|
||||
if (this._isTerminating) {
|
||||
logger.info('c9-shell-handler: _isTerminating, skip terminate');
|
||||
return;
|
||||
@ -91,7 +91,12 @@ class C9ShellHandler {
|
||||
logger.info('c9-shell-handler: terminate');
|
||||
this._isTerminating = true;
|
||||
this._c9shell.kill();
|
||||
}
|
||||
return new Promise<number>((resolve) => {
|
||||
this._c9shell?.on('exit', (code) => {
|
||||
resolve(code || 0);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Update the current shell status and notify the callback if set.
|
||||
@ -246,9 +251,9 @@ export const loadC9Shell = async (sender: WebContents) => {
|
||||
/**
|
||||
* Terminates the C9 shell process asynchronously, if it is running.
|
||||
*/
|
||||
export const terminateC9Shell = () => {
|
||||
export const terminateC9Shell = async () => {
|
||||
if (!c9ShellHandler) {
|
||||
return;
|
||||
}
|
||||
c9ShellHandler.terminateShell();
|
||||
await c9ShellHandler.terminateShell();
|
||||
};
|
||||
|
@ -43,6 +43,7 @@ import { AppMenu } from './app-menu';
|
||||
import { analytics } from './bi/analytics-handler';
|
||||
import { SDAEndReasonTypes, SDAUserSessionActionTypes } from './bi/interface';
|
||||
import { closeC9Pipe } from './c9-pipe-handler';
|
||||
import { terminateC9Shell } from './c9-shell-handler';
|
||||
import { handleChildWindow } from './child-window-handler';
|
||||
import {
|
||||
CloudConfigDataTypes,
|
||||
@ -2344,6 +2345,7 @@ export class WindowHandler {
|
||||
if (shouldRelaunch) {
|
||||
app.relaunch();
|
||||
}
|
||||
await terminateC9Shell();
|
||||
app.exit();
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user