From 540edb02952acf869b2cce385a1ad96eef391b27 Mon Sep 17 00:00:00 2001 From: Emanuele Libralato Date: Thu, 23 May 2019 17:59:53 +0200 Subject: [PATCH] fix: crash when deploy and docker not installed Fixes #768 --- garden-service/src/util/util.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/garden-service/src/util/util.ts b/garden-service/src/util/util.ts index a861d2e847..917d1115d7 100644 --- a/garden-service/src/util/util.ts +++ b/garden-service/src/util/util.ts @@ -167,6 +167,14 @@ export function spawn(cmd: string, args: string[], opts: SpawnOpts = {}) { }, timeout * 1000) } + proc.on("error", (err) => { + let msg = `An error occurred while trying to run '${cmd}'.` + if ((err).code === "ENOENT") { + msg = `${msg} Please make sure '${cmd}' is installed and in the $PATH.` + } + _reject(new RuntimeError(msg, { cmd, args, opts, result, err })) + }) + proc.on("close", (code) => { _timeout && clearTimeout(_timeout) result.code = code