@aneuhold/core-ts-lib 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -27,10 +27,13 @@ export default class CLIService {
|
|
|
27
27
|
* @param cwd the current working directory to run the command in. If not
|
|
28
28
|
* provided, it will use the current working directory of the process.
|
|
29
29
|
*
|
|
30
|
+
* @param useProfile if set to true will use the current profile or zshrc of
|
|
31
|
+
* the shell environment. By default this is false.
|
|
32
|
+
*
|
|
30
33
|
* @returns an object that holds the output and true if the command completed
|
|
31
34
|
* successfully or false if it did not.
|
|
32
35
|
*/
|
|
33
|
-
static execCmd(cmd: string, logError?: boolean, cwd?: string): Promise<ExecCmdReturnType>;
|
|
36
|
+
static execCmd(cmd: string, logError?: boolean, cwd?: string, useProfile?: boolean): Promise<ExecCmdReturnType>;
|
|
34
37
|
/**
|
|
35
38
|
* Executes the given command but fulfills the
|
|
36
39
|
* promise when either the command completes, or the given number of ms have
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CLIService.d.ts","sourceRoot":"","sources":["../../src/services/CLIService.ts"],"names":[],"mappings":"AAYA,KAAK,iBAAiB,GAAG;IAAE,WAAW,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAElE;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAA+B;IAE/D
|
|
1
|
+
{"version":3,"file":"CLIService.d.ts","sourceRoot":"","sources":["../../src/services/CLIService.ts"],"names":[],"mappings":"AAYA,KAAK,iBAAiB,GAAG;IAAE,WAAW,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAElE;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAA+B;IAE/D;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;WACU,OAAO,CAClB,GAAG,EAAE,MAAM,EACX,QAAQ,UAAQ,EAChB,GAAG,CAAC,EAAE,MAAM,EACZ,UAAU,UAAQ,GACjB,OAAO,CAAC,iBAAiB,CAAC;IA6C7B;;;;;;;OAOG;WACU,kBAAkB,CAC7B,OAAO,EAAE,MAAM,EACf,EAAE,SAAO,GACR,OAAO,CAAC,iBAAiB,CAAC;IAU7B;;;;;;;;;;;;OAYG;WACU,QAAQ,CACnB,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,MAAM,EAAE,EACf,uBAAuB,CAAC,EAAE,MAAM,GAC/B,OAAO,CAAC,iBAAiB,CAAC;IAkC7B;;;;;OAKG;WACU,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAYjE"}
|
|
@@ -61,10 +61,13 @@ class CLIService {
|
|
|
61
61
|
* @param cwd the current working directory to run the command in. If not
|
|
62
62
|
* provided, it will use the current working directory of the process.
|
|
63
63
|
*
|
|
64
|
+
* @param useProfile if set to true will use the current profile or zshrc of
|
|
65
|
+
* the shell environment. By default this is false.
|
|
66
|
+
*
|
|
64
67
|
* @returns an object that holds the output and true if the command completed
|
|
65
68
|
* successfully or false if it did not.
|
|
66
69
|
*/
|
|
67
|
-
static async execCmd(cmd, logError = false, cwd) {
|
|
70
|
+
static async execCmd(cmd, logError = false, cwd, useProfile = false) {
|
|
68
71
|
const execOptions = {};
|
|
69
72
|
if (cwd) {
|
|
70
73
|
execOptions.cwd = cwd;
|
|
@@ -72,9 +75,12 @@ class CLIService {
|
|
|
72
75
|
let commandToExecute = cmd;
|
|
73
76
|
// Set the powershell prefix if the current OS is Windows so that
|
|
74
77
|
// the profile is not ran before the command.
|
|
75
|
-
if (CurrentEnv_1.default.os === CurrentEnv_1.OperatingSystemType.Windows) {
|
|
78
|
+
if (CurrentEnv_1.default.os === CurrentEnv_1.OperatingSystemType.Windows && !useProfile) {
|
|
76
79
|
commandToExecute = `${CLIService.POWERSHELL_PREFIX}${cmd}`;
|
|
77
80
|
}
|
|
81
|
+
else if (CurrentEnv_1.default.os === CurrentEnv_1.OperatingSystemType.Windows && useProfile) {
|
|
82
|
+
execOptions.shell = 'pwsh';
|
|
83
|
+
}
|
|
78
84
|
Logger_1.default.verbose.info(`Executing command: ${commandToExecute}`);
|
|
79
85
|
try {
|
|
80
86
|
const { stdout, stderr } = await execute(commandToExecute, execOptions);
|