From 3ff4bbb9a77fd20b226b801860d9b61671306fc8 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Fri, 29 Jan 2021 17:55:55 -0500 Subject: [PATCH] chore: look for binary within the app bundle instead of the system path --- ui/desktop/electron-app/src/boundary-cli.js | 6 +++--- ui/desktop/electron-app/src/spawn-promise.js | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ui/desktop/electron-app/src/boundary-cli.js b/ui/desktop/electron-app/src/boundary-cli.js index 42618b71b..ce740d87c 100644 --- a/ui/desktop/electron-app/src/boundary-cli.js +++ b/ui/desktop/electron-app/src/boundary-cli.js @@ -1,7 +1,7 @@ -const { lookpath } = require('lookpath'); +const path = require('path'); const spawnPromise = require('./spawn-promise'); -const cliPath = async () => await lookpath('boundary'); +const cliPath = async () => path.resolve(__dirname, 'binary', 'boundary'); module.exports = { // Find boundary cli path @@ -17,7 +17,7 @@ module.exports = { `-addr=${addr}`, '-format=json', '--output-json-errors' - ] + ]; return spawnPromise(command); } } diff --git a/ui/desktop/electron-app/src/spawn-promise.js b/ui/desktop/electron-app/src/spawn-promise.js index 7daf188e1..1dabe4fea 100644 --- a/ui/desktop/electron-app/src/spawn-promise.js +++ b/ui/desktop/electron-app/src/spawn-promise.js @@ -1,3 +1,4 @@ +const path = require('path'); const { spawn } = require('child_process'); // Convert to json @@ -26,7 +27,10 @@ const jsonify = (data) => { // POJO representation and throw it or promise->reject it. module.exports = function spawnPromise (command) { return new Promise((resolve, reject) => { - const childProcess = spawn('boundary', command); + const boundaryPath = path.resolve(__dirname, 'binary', 'boundary'); + // TODO: remove path logging + console.log(boundaryPath); + const childProcess = spawn(boundaryPath, command); let outputStream = ''; let errorStream = '';