From e2b11c83d596faa7b56b6eb5ccfb56cca24a26a1 Mon Sep 17 00:00:00 2001 From: Eugene Pankov Date: Thu, 28 Jan 2021 21:11:47 +0100 Subject: [PATCH] fixed cli args handling --- terminus-core/src/services/hostApp.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/terminus-core/src/services/hostApp.service.ts b/terminus-core/src/services/hostApp.service.ts index 2c674a06..d400eb6c 100644 --- a/terminus-core/src/services/hostApp.service.ts +++ b/terminus-core/src/services/hostApp.service.ts @@ -154,7 +154,7 @@ export class HostAppService { electron.ipcRenderer.on('cli', (_$event, argv: any, cwd: string, secondInstance: boolean) => this.zone.run(async () => { this.logger.info('Second instance', argv) const op = argv._[0] - const opAsPath = path.resolve(cwd, op) + const opAsPath = op ? path.resolve(cwd, op) : null if (op === 'open') { this.cliOpenDirectory.next(path.resolve(cwd, argv.directory)) } else if (op === 'run') { @@ -167,9 +167,9 @@ export class HostAppService { this.cliPaste.next(text) } else if (op === 'profile') { this.cliOpenProfile.next(argv.profileName) - } else if (op === undefined) { + } else if (secondInstance && op === undefined) { this.newWindow() - } else if ((await fs.lstat(opAsPath)).isDirectory()) { + } else if (opAsPath && (await fs.lstat(opAsPath)).isDirectory()) { this.cliOpenDirectory.next(opAsPath) }