From f9c645120bcf78bb4b1dbdc014d3f411f201a1e2 Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Sun, 17 May 2020 18:12:58 +0200 Subject: [PATCH] run in shell to set paths and find restic --- src/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index 12ff36e..04385f4 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -30,7 +30,7 @@ export const execPlain = (command: string, opt: SpawnSyncOptions = {}) => { const split = command.split(' ') if (split.length < 1) throw new Error(`The command ${command} is not valid`.red) - return exec(split[0], split.slice(1), opt) + return exec(split[0], split.slice(1), { shell: true, ...opt }) } export const checkIfResticIsAvailable = () => @@ -42,7 +42,7 @@ export const checkIfResticIsAvailable = () => ) export const checkIfCommandIsAvailable = (cmd: string, errorMsg?: string) => { - if (spawnSync(cmd).error) + if (spawnSync(cmd, { shell: true }).error) throw new Error(errorMsg ? errorMsg : `"${cmd}" is not installed`.red) }