mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-26 08:51:22 -06:00
RTC-14795 Abort launching of c9shell if network is offline (#2074)
* Abort launching of c9shell if network is offline * invert * unit test mocking * mock
This commit is contained in:
parent
0bb3f1449e
commit
e1b97221c0
@ -37,6 +37,12 @@ describe('C9 shell handler', () => {
|
||||
};
|
||||
});
|
||||
|
||||
jest.mock('../src/app/window-handler', () => {
|
||||
return {
|
||||
windowHandler: { isOnline: true },
|
||||
};
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks().resetModules().resetAllMocks();
|
||||
mockSpawnEvents.clear();
|
||||
|
@ -26,6 +26,12 @@ jest.mock('../src/common/logger', () => {
|
||||
};
|
||||
});
|
||||
|
||||
jest.mock('../src/app/window-handler', () => {
|
||||
return {
|
||||
windowHandler: { isOnline: true },
|
||||
};
|
||||
});
|
||||
|
||||
describe('config', () => {
|
||||
const configFileName: string = 'Symphony.config';
|
||||
let userConfigDir: string;
|
||||
|
@ -5,6 +5,7 @@ import { isDevEnv, isWindowsOS } from '../common/env';
|
||||
import { ChildProcess, spawn } from 'child_process';
|
||||
import * as path from 'path';
|
||||
import { getCommandLineArgs, getGuid } from '../common/utils';
|
||||
import { windowHandler } from './window-handler';
|
||||
|
||||
/**
|
||||
* Current state of the C9 shell process.
|
||||
@ -162,6 +163,13 @@ class C9ShellHandler {
|
||||
* Launches the correct c9shell process
|
||||
*/
|
||||
private async _launchC9Shell(): Promise<ChildProcess | undefined> {
|
||||
if (!windowHandler.isOnline) {
|
||||
logger.info(
|
||||
'c9-shell: launching of shell aborted due to network unavailability.',
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
this._curStatus = undefined;
|
||||
const uniquePipeName = getGuid();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user