From cb71aca173e5052674a38d09842da8ce6b2449eb Mon Sep 17 00:00:00 2001 From: Gnanakeethan Balasubramaniam Date: Mon, 11 Sep 2023 14:23:05 +0530 Subject: [PATCH] Ability to run commands with multiple spaces Signed-off-by: Gnanakeethan Balasubramaniam --- src/lib/shell-imp/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/shell-imp/index.ts b/src/lib/shell-imp/index.ts index 417c9b389..630059dd6 100644 --- a/src/lib/shell-imp/index.ts +++ b/src/lib/shell-imp/index.ts @@ -90,8 +90,13 @@ export class ShellModel implements IImpactModelInterface { private runModelInShell(input: string, execPath: string): KeyValuePair { try { console.log('input', input); + const execs = execPath.split(' '); + const executable = execs.pop() ?? ''; const result = cp - .spawnSync(execPath, ['--calculate'], {input: input, encoding: 'utf8'}) + .spawnSync(executable, [...execs, '--calculate'], { + input: input, + encoding: 'utf8', + }) .stdout.toString(); console.log('result', result); return yaml.load(result) as KeyValuePair;