fix: Fix cli path on windows to launch connect shell
This commit is contained in:
1 parent
7b2c8b7d58
commit
196d01aae2
3 files changed
+18
-14
No files matched your search
@@ -1,16 +1,9 @@
|
||||
const path = require('path');
|
||||
const { isWindows } = require('../helpers/platform.js');
|
||||
const { spawnSync } = require('../helpers/spawn-promise.js');
|
||||
|
||||
const cliPath = async () => {
|
||||
let name = 'boundary';
|
||||
if (isWindows()) name = 'boundary.exe';
|
||||
return path.resolve(__dirname, '..', 'cli', name);
|
||||
};
|
||||
const { path } = require('./path.js');
|
||||
|
||||
module.exports = {
|
||||
// Check boundary cli existence
|
||||
exists: () => Boolean(cliPath()),
|
||||
exists: () => Boolean(path()),
|
||||
|
||||
// Returns JSON-formatted version information from the CLI
|
||||
version: () => {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
const path = require('path');
|
||||
const { isWindows } = require('../helpers/platform.js');
|
||||
|
||||
module.exports = {
|
||||
// Returns boundary cli path
|
||||
path: () => {
|
||||
let name = 'boundary';
|
||||
if (isWindows()) name = 'boundary.exe';
|
||||
return path.resolve(__dirname, '..', '..', 'cli', name);
|
||||
}
|
||||
};
|
||||
@@ -1,8 +1,7 @@
|
||||
const path = require('path');
|
||||
const { path } = require('../cli/path.js');
|
||||
const { spawn, spawnSync } = require('child_process');
|
||||
const jsonify = require('../utils/jsonify.js');
|
||||
|
||||
const boundaryPath = path.resolve(__dirname, '..', '..', 'cli', 'boundary');
|
||||
const { isWindows } = require('../helpers/platform.js');
|
||||
|
||||
// You can throw exceptions, or allow them to occur, and this is supported.
|
||||
// Exceptions thrown in this way will be returned to the UI as an
|
||||
@@ -29,7 +28,7 @@ module.exports = {
|
||||
*/
|
||||
spawnAsyncJSONPromise(command) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const childProcess = spawn(boundaryPath, command);
|
||||
const childProcess = spawn(path(), command, { shell: isWindows() });
|
||||
let outputStream = '';
|
||||
let errorStream = '';
|
||||
|
||||
@@ -56,6 +55,7 @@ module.exports = {
|
||||
};
|
||||
|
||||
childProcess.stderr.on('error', processError);
|
||||
childProcess.stderr.on('data', processError);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -66,7 +66,7 @@ module.exports = {
|
||||
* @return {string}
|
||||
*/
|
||||
spawnSync(command) {
|
||||
const childProcess = spawnSync(boundaryPath, command);
|
||||
const childProcess = spawnSync(path(), command, { shell: isWindows() });
|
||||
const rawOutput = childProcess.output.toString();
|
||||
return rawOutput;
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user