From aa3df4e93d5abbc3b7ee0e553a5aadbba1144622 Mon Sep 17 00:00:00 2001 From: Clemens Buchacher Date: Wed, 6 Jun 2018 14:04:54 +0200 Subject: [PATCH 1/2] fix token refresh for GKE on Windows A proper solution would be to pass command line arguments as an array. Unfortunately, this is not currently possible with shelljs. See also https://github.com/shelljs/shelljs/issues/143. As a workaround, surround the command with quotes to at least fix commands with spaces. Closes #50. --- node-client/src/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-client/src/config.ts b/node-client/src/config.ts index d5f8fb6dee..d176b8bee3 100644 --- a/node-client/src/config.ts +++ b/node-client/src/config.ts @@ -130,7 +130,7 @@ export class KubeConfig { let expiration = Date.parse(expiry); if (expiration < Date.now()) { if (config['cmd-path']) { - let cmd = config['cmd-path']; + let cmd = '"' + config['cmd-path'] + '"'; if (config['cmd-args']) { cmd = cmd + ' ' + config['cmd-args']; } From 738118ff3af4e5ab9732cc01068e6d6b6a55770f Mon Sep 17 00:00:00 2001 From: Clemens Buchacher Date: Wed, 6 Jun 2018 14:39:30 +0200 Subject: [PATCH 2/2] output error stream from subprocess --- node-client/src/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-client/src/config.ts b/node-client/src/config.ts index d176b8bee3..120f509e3f 100644 --- a/node-client/src/config.ts +++ b/node-client/src/config.ts @@ -137,7 +137,7 @@ export class KubeConfig { // TODO: Cache to file? const result = shelljs.exec(cmd, { silent: true }); if (result['code'] != 0) { - throw new Error('Failed to refresh token: ' + result); + throw new Error('Failed to refresh token: ' + result.stderr); } let resultObj = JSON.parse(result.stdout.toString());