Commit dab607c
Changed files (4)
build/core.cjs
@@ -1065,23 +1065,14 @@ _ProcessOutput.getErrorMessage = Fail.formatErrorMessage;
_ProcessOutput.getErrorDetails = Fail.formatErrorDetails;
_ProcessOutput.getExitCodeInfo = Fail.getExitCodeInfo;
var ProcessOutput = _ProcessOutput;
-function usePowerShell() {
- $.shell = import_vendor_core2.which.sync("powershell.exe");
- $.prefix = "";
- $.postfix = "; exit $LastExitCode";
- $.quote = import_util.quotePowerShell;
-}
-function usePwsh() {
- $.shell = import_vendor_core2.which.sync("pwsh");
- $.prefix = "";
- $.postfix = "; exit $LastExitCode";
- $.quote = import_util.quotePowerShell;
-}
-function useBash() {
- $.shell = import_vendor_core2.which.sync("bash");
- $.prefix = "set -euo pipefail;";
- $.postfix = "";
- $.quote = import_util.quote;
+var useBash = () => setShell("bash", false);
+var usePwsh = () => setShell("pwsh");
+var usePowerShell = () => setShell("powershell.exe");
+function setShell(n, ps3 = true) {
+ $.shell = import_vendor_core2.which.sync(n);
+ $.prefix = ps3 ? "" : "set -euo pipefail;";
+ $.postfix = ps3 ? "; exit $LastExitCode" : "";
+ $.quote = ps3 ? import_util.quotePowerShell : import_util.quote;
}
try {
const { shell, prefix, postfix } = $;
build/core.d.ts
@@ -202,9 +202,9 @@ export declare class ProcessOutput extends Error {
static getExitCodeInfo: typeof Fail.getExitCodeInfo;
static fromError(error: Error): ProcessOutput;
}
-export declare function usePowerShell(): void;
-export declare function usePwsh(): void;
-export declare function useBash(): void;
+export declare const useBash: () => void;
+export declare const usePwsh: () => void;
+export declare const usePowerShell: () => void;
export declare function syncProcessCwd(flag?: boolean): void;
export declare function cd(dir: string | ProcessOutput): void;
export declare function kill(pid: number, signal?: NodeJS.Signals): Promise<void>;
src/core.ts
@@ -977,11 +977,8 @@ export class ProcessOutput extends Error {
}
static getExitMessage = Fail.formatExitMessage
-
static getErrorMessage = Fail.formatErrorMessage
-
static getErrorDetails = Fail.formatErrorDetails
-
static getExitCodeInfo = Fail.getExitCodeInfo
static fromError(error: Error): ProcessOutput {
@@ -991,25 +988,14 @@ export class ProcessOutput extends Error {
}
}
-export function usePowerShell() {
- $.shell = which.sync('powershell.exe')
- $.prefix = ''
- $.postfix = '; exit $LastExitCode'
- $.quote = quotePowerShell
-}
-
-export function usePwsh() {
- $.shell = which.sync('pwsh')
- $.prefix = ''
- $.postfix = '; exit $LastExitCode'
- $.quote = quotePowerShell
-}
-
-export function useBash() {
- $.shell = which.sync('bash')
- $.prefix = 'set -euo pipefail;'
- $.postfix = ''
- $.quote = quote
+export const useBash = (): void => setShell('bash', false)
+export const usePwsh = (): void => setShell('pwsh')
+export const usePowerShell = (): void => setShell('powershell.exe')
+function setShell(n: string, ps = true) {
+ $.shell = which.sync(n)
+ $.prefix = ps ? '' : 'set -euo pipefail;'
+ $.postfix = ps ? '; exit $LastExitCode' : ''
+ $.quote = ps ? quotePowerShell : quote
}
try {
.size-limit.json
@@ -15,7 +15,7 @@
"README.md",
"LICENSE"
],
- "limit": "125.00 kB",
+ "limit": "124.85 kB",
"brotli": false,
"gzip": false
},
@@ -29,7 +29,7 @@
"build/globals.js",
"build/deno.js"
],
- "limit": "815.10 kB",
+ "limit": "814.95 kB",
"brotli": false,
"gzip": false
},
@@ -62,7 +62,7 @@
"README.md",
"LICENSE"
],
- "limit": "872.45 kB",
+ "limit": "872.35 kB",
"brotli": false,
"gzip": false
}