Commit 523ef8e

Anton Golub <antongolub@antongolub.com>
2025-07-09 12:36:25
fix: dont override `$.prefix` setting defined via envs, revert `env.S… (#1261) tag: 8.6.2
* fix: dont override `$.prefix` setting defined via envs * revert: `env.SHELL` as default * test: update size-limit * refactor: preserve `env.ZX_POSTFIX` value * chore: bump version to v8.6.2
1 parent b55c5f4
build/core.cjs
@@ -417,12 +417,10 @@ var defaults = resolveDefaults({
   verbose: false,
   env: import_node_process2.default.env,
   sync: false,
-  shell: import_node_process2.default.env.SHELL || true,
+  shell: true,
   stdio: "pipe",
   nothrow: false,
   quiet: false,
-  prefix: "",
-  postfix: "",
   detached: false,
   preferLocal: false,
   spawn: import_node_child_process.spawn,
@@ -665,7 +663,7 @@ var _ProcessPromise = class _ProcessPromise extends Promise {
     return this._command;
   }
   get fullCmd() {
-    return this._snapshot.prefix + this.cmd + this._snapshot.postfix;
+    return (this._snapshot.prefix || "") + this.cmd + (this._snapshot.postfix || "");
   }
   get child() {
     var _a;
@@ -968,9 +966,11 @@ function useBash() {
   $.quote = import_util.quote;
 }
 try {
-  const { shell } = $;
+  const { shell, prefix, postfix } = $;
   useBash();
   if ((0, import_util.isString)(shell)) $.shell = shell;
+  if ((0, import_util.isString)(prefix)) $.prefix = prefix;
+  if ((0, import_util.isString)(postfix)) $.postfix = postfix;
 } catch (err) {
 }
 function checkShell() {
build/core.d.ts
@@ -32,8 +32,8 @@ export interface Options {
     env: NodeJS.ProcessEnv;
     shell: string | true;
     nothrow: boolean;
-    prefix: string;
-    postfix: string;
+    prefix?: string;
+    postfix?: string;
     quote?: typeof quote;
     quiet: boolean;
     detached: boolean;
src/core.ts
@@ -116,8 +116,8 @@ export interface Options {
   env:            NodeJS.ProcessEnv
   shell:          string | true
   nothrow:        boolean
-  prefix:         string
-  postfix:        string
+  prefix?:        string
+  postfix?:       string
   quote?:         typeof quote
   quiet:          boolean
   detached:       boolean
@@ -139,12 +139,10 @@ export const defaults: Options = resolveDefaults({
   verbose:        false,
   env:            process.env,
   sync:           false,
-  shell:          process.env.SHELL || true,
+  shell:          true,
   stdio:          'pipe',
   nothrow:        false,
   quiet:          false,
-  prefix:         '',
-  postfix:        '',
   detached:       false,
   preferLocal:    false,
   spawn,
@@ -475,7 +473,9 @@ export class ProcessPromise extends Promise<ProcessOutput> {
   }
 
   get fullCmd(): string {
-    return this._snapshot.prefix + this.cmd + this._snapshot.postfix
+    return (
+      (this._snapshot.prefix || '') + this.cmd + (this._snapshot.postfix || '')
+    )
   }
 
   get child(): ChildProcess | undefined {
@@ -877,9 +877,11 @@ export function useBash() {
 }
 
 try {
-  const { shell } = $
+  const { shell, prefix, postfix } = $
   useBash()
   if (isString(shell)) $.shell = shell
+  if (isString(prefix)) $.prefix = prefix
+  if (isString(postfix)) $.postfix = postfix
 } catch (err) {}
 
 function checkShell() {
.size-limit.json
@@ -15,7 +15,7 @@
       "README.md",
       "LICENSE"
     ],
-    "limit": "121.80 kB",
+    "limit": "121.90 kB",
     "brotli": false,
     "gzip": false
   },
@@ -29,7 +29,7 @@
       "build/globals.js",
       "build/deno.js"
     ],
-    "limit": "812.35 kB",
+    "limit": "812.42 kB",
     "brotli": false,
     "gzip": false
   },
@@ -62,7 +62,7 @@
       "README.md",
       "LICENSE"
     ],
-    "limit": "868.35 kB",
+    "limit": "868.45 kB",
     "brotli": false,
     "gzip": false
   }
package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "zx",
-  "version": "8.6.1",
+  "version": "8.6.2",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "zx",
-      "version": "8.6.1",
+      "version": "8.6.2",
       "license": "Apache-2.0",
       "bin": {
         "zx": "build/cli.js"
package.json
@@ -1,6 +1,6 @@
 {
   "name": "zx",
-  "version": "8.6.1",
+  "version": "8.6.2",
   "description": "A tool for writing better scripts",
   "type": "module",
   "main": "./build/index.cjs",