mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -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:
@@ -77,7 +77,7 @@ class C9ShellHandler {
|
|||||||
/**
|
/**
|
||||||
* Terminates the c9shell process if it was started by this handler.
|
* Terminates the c9shell process if it was started by this handler.
|
||||||
*/
|
*/
|
||||||
public terminateShell() {
|
public terminateShell = async () => {
|
||||||
if (this._isTerminating) {
|
if (this._isTerminating) {
|
||||||
logger.info('c9-shell-handler: _isTerminating, skip terminate');
|
logger.info('c9-shell-handler: _isTerminating, skip terminate');
|
||||||
return;
|
return;
|
||||||
@@ -91,7 +91,12 @@ class C9ShellHandler {
|
|||||||
logger.info('c9-shell-handler: terminate');
|
logger.info('c9-shell-handler: terminate');
|
||||||
this._isTerminating = true;
|
this._isTerminating = true;
|
||||||
this._c9shell.kill();
|
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.
|
* 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.
|
* Terminates the C9 shell process asynchronously, if it is running.
|
||||||
*/
|
*/
|
||||||
export const terminateC9Shell = () => {
|
export const terminateC9Shell = async () => {
|
||||||
if (!c9ShellHandler) {
|
if (!c9ShellHandler) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
c9ShellHandler.terminateShell();
|
await c9ShellHandler.terminateShell();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import { AppMenu } from './app-menu';
|
|||||||
import { analytics } from './bi/analytics-handler';
|
import { analytics } from './bi/analytics-handler';
|
||||||
import { SDAEndReasonTypes, SDAUserSessionActionTypes } from './bi/interface';
|
import { SDAEndReasonTypes, SDAUserSessionActionTypes } from './bi/interface';
|
||||||
import { closeC9Pipe } from './c9-pipe-handler';
|
import { closeC9Pipe } from './c9-pipe-handler';
|
||||||
|
import { terminateC9Shell } from './c9-shell-handler';
|
||||||
import { handleChildWindow } from './child-window-handler';
|
import { handleChildWindow } from './child-window-handler';
|
||||||
import {
|
import {
|
||||||
CloudConfigDataTypes,
|
CloudConfigDataTypes,
|
||||||
@@ -2344,6 +2345,7 @@ export class WindowHandler {
|
|||||||
if (shouldRelaunch) {
|
if (shouldRelaunch) {
|
||||||
app.relaunch();
|
app.relaunch();
|
||||||
}
|
}
|
||||||
|
await terminateC9Shell();
|
||||||
app.exit();
|
app.exit();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user