chore: look for binary within the app bundle instead of the system path

This commit is contained in:
Randall Morey committed 2021-01-29 17:55:55 -05:00
1 parent cdf260303c
commit 3ff4bbb9a7
2 files changed
+8 -4

No files matched your search

+3 -3
View File
@@ -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);
}
}
+5 -1
View File
@@ -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 = '';