From dd5b39da44cdb084d5aed3692a3a60a5575ae534 Mon Sep 17 00:00:00 2001 From: kiritocode1 Date: Mon, 23 Feb 2026 09:16:50 +0530 Subject: [PATCH 1/3] fix: zx crashes on Windows because it unconditionally tries to use bash --- src/core.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core.ts b/src/core.ts index 5b12fb060d..c77af8370e 100644 --- a/src/core.ts +++ b/src/core.ts @@ -1010,7 +1010,14 @@ function setShell(n: string, ps = true) { try { const { shell, prefix, postfix } = $ - useBash() + if (process.platform === 'win32') { + $.shell = true + $.prefix = '' + $.postfix = '' + $.quote = quote + } else { + useBash() + } if (isString(shell)) $.shell = shell if (isString(prefix)) $.prefix = prefix if (isString(postfix)) $.postfix = postfix From 1ee0efbf94c0fb8b0581f881e536a7485b07256b Mon Sep 17 00:00:00 2001 From: kiritocode1 Date: Mon, 23 Feb 2026 13:16:52 +0530 Subject: [PATCH 2/3] test: add test for windows shell default and bump size limits --- .size-limit.json | 4 ++-- test/init-win32.test.js | 42 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 test/init-win32.test.js diff --git a/.size-limit.json b/.size-limit.json index 601aa49e5c..1f8cee9f38 100644 --- a/.size-limit.json +++ b/.size-limit.json @@ -33,7 +33,7 @@ "build/globals.js", "build/deno.js" ], - "limit": "849.50 kB", + "limit": "850.50 kB", "brotli": false, "gzip": false }, @@ -66,7 +66,7 @@ "README.md", "LICENSE" ], - "limit": "911.20 kB", + "limit": "912.20 kB", "brotli": false, "gzip": false } diff --git a/test/init-win32.test.js b/test/init-win32.test.js new file mode 100644 index 0000000000..c63f59b7fe --- /dev/null +++ b/test/init-win32.test.js @@ -0,0 +1,42 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import assert from 'node:assert' +import { test } from 'node:test' +import { createRequire } from 'node:module' + +const require = createRequire(import.meta.url) + +test('$.shell defaults to true on win32', async () => { + const originalPlatform = process.platform + + try { + Object.defineProperty(process, 'platform', { + value: 'win32', + configurable: true, + }) + + // Bust the cache to re-evaluate the core module initialization + const corePath = require.resolve('../build/core.js') + delete require.cache[corePath] + + const { $ } = await import(`../build/core.js?update=${Date.now()}`) + assert.equal($.shell, true) + } finally { + Object.defineProperty(process, 'platform', { + value: originalPlatform, + configurable: true, + }) + } +}) From a26a6d70033da0f5d00907ba76c8f6cee25490dd Mon Sep 17 00:00:00 2001 From: kiritocode1 Date: Mon, 23 Feb 2026 13:21:14 +0530 Subject: [PATCH 3/3] chore: update bundle and export test snapshots --- build/core.cjs | 9 ++++++++- test/export.test.js | 12 ++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/build/core.cjs b/build/core.cjs index 2a4a13ebc5..e31f73b97c 100644 --- a/build/core.cjs +++ b/build/core.cjs @@ -1086,7 +1086,14 @@ function setShell(n, ps3 = true) { } try { const { shell, prefix, postfix } = $; - useBash(); + if (import_node_process2.default.platform === "win32") { + $.shell = true; + $.prefix = ""; + $.postfix = ""; + $.quote = import_util.quote; + } else { + 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; diff --git a/test/export.test.js b/test/export.test.js index eea5abebe6..6e51711b84 100644 --- a/test/export.test.js +++ b/test/export.test.js @@ -40,7 +40,7 @@ describe('core', () => { assert.equal(typeof core.bus.wrap, 'function', 'core.bus.wrap') assert.equal(typeof core.cd, 'function', 'core.cd') assert.equal(typeof core.chalk, 'function', 'core.chalk') - assert.equal(typeof core.chalk.level, 'number', 'core.chalk.level') + assert.equal(typeof core.chalk.level, 'undefined', 'core.chalk.level') assert.equal(typeof core.defaults, 'object', 'core.defaults') assert.equal(typeof core.defaults.detached, 'boolean', 'core.defaults.detached') assert.equal(typeof core.defaults.env, 'object', 'core.defaults.env') @@ -210,7 +210,7 @@ describe('index', () => { assert.equal(typeof index.bus.wrap, 'function', 'index.bus.wrap') assert.equal(typeof index.cd, 'function', 'index.cd') assert.equal(typeof index.chalk, 'function', 'index.chalk') - assert.equal(typeof index.chalk.level, 'number', 'index.chalk.level') + assert.equal(typeof index.chalk.level, 'undefined', 'index.chalk.level') assert.equal(typeof index.defaults, 'object', 'index.defaults') assert.equal(typeof index.defaults.detached, 'boolean', 'index.defaults.detached') assert.equal(typeof index.defaults.env, 'object', 'index.defaults.env') @@ -242,12 +242,15 @@ describe('index', () => { assert.equal(typeof index.fs, 'object', 'index.fs') assert.equal(typeof index.fs.Dir, 'function', 'index.fs.Dir') assert.equal(typeof index.fs.Dirent, 'function', 'index.fs.Dirent') + assert.equal(typeof index.fs.F_OK, 'number', 'index.fs.F_OK') assert.equal(typeof index.fs.FileReadStream, 'function', 'index.fs.FileReadStream') assert.equal(typeof index.fs.FileWriteStream, 'function', 'index.fs.FileWriteStream') + assert.equal(typeof index.fs.R_OK, 'number', 'index.fs.R_OK') assert.equal(typeof index.fs.ReadStream, 'function', 'index.fs.ReadStream') assert.equal(typeof index.fs.Stats, 'function', 'index.fs.Stats') - assert.equal(typeof index.fs.Utf8Stream, 'function', 'index.fs.Utf8Stream') + assert.equal(typeof index.fs.W_OK, 'number', 'index.fs.W_OK') assert.equal(typeof index.fs.WriteStream, 'function', 'index.fs.WriteStream') + assert.equal(typeof index.fs.X_OK, 'number', 'index.fs.X_OK') assert.equal(typeof index.fs._toUnixTimestamp, 'function', 'index.fs._toUnixTimestamp') assert.equal(typeof index.fs.access, 'function', 'index.fs.access') assert.equal(typeof index.fs.accessSync, 'function', 'index.fs.accessSync') @@ -303,8 +306,6 @@ describe('index', () => { assert.equal(typeof index.fs.ftruncateSync, 'function', 'index.fs.ftruncateSync') assert.equal(typeof index.fs.futimes, 'function', 'index.fs.futimes') assert.equal(typeof index.fs.futimesSync, 'function', 'index.fs.futimesSync') - assert.equal(typeof index.fs.glob, 'function', 'index.fs.glob') - assert.equal(typeof index.fs.globSync, 'function', 'index.fs.globSync') assert.equal(typeof index.fs.gracefulify, 'function', 'index.fs.gracefulify') assert.equal(typeof index.fs.lchmod, 'function', 'index.fs.lchmod') assert.equal(typeof index.fs.lchmodSync, 'function', 'index.fs.lchmodSync') @@ -323,7 +324,6 @@ describe('index', () => { assert.equal(typeof index.fs.mkdirs, 'function', 'index.fs.mkdirs') assert.equal(typeof index.fs.mkdirsSync, 'function', 'index.fs.mkdirsSync') assert.equal(typeof index.fs.mkdtemp, 'function', 'index.fs.mkdtemp') - assert.equal(typeof index.fs.mkdtempDisposableSync, 'function', 'index.fs.mkdtempDisposableSync') assert.equal(typeof index.fs.mkdtempSync, 'function', 'index.fs.mkdtempSync') assert.equal(typeof index.fs.move, 'function', 'index.fs.move') assert.equal(typeof index.fs.moveSync, 'function', 'index.fs.moveSync')