google / google/zx

Paths in Git Bash on Windows don't work

Open
#1,211 7 comments 0 reactions 1 assignee Claimed by @antongolub View on GitHub
Dominant language
JavaScript
Stars
45.7k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

### Reproduction

`windows-test.mjs`:

```javascript
import { $ } from 'zx'
import path from 'node:path'
import { fileURLToPath } from 'url'

const __dirname = path.dirname(fileURLToPath(import.meta.url))

$.verbose = true
await $`zx --version`
await $`mkdir -p ${path.join(__dirname, 'AA-zx-test')}`
await $`mkdir -p BB-zx-test`
await $`ls -l | grep zx-test`
```

### Actual behavior

```
await $`mkdir -p ${path.join(__dirname, 'AA-zx-test')}`
```

silently does nothing on Windows in Git Bash.

The generated command

```
mkdir -p $'C:\\git\\frontend_main\\apps\\acheron\\AA-zx-test'
```

appears to be correct though, as running it manually works.

![Image](https://github.com/user-attachments/assets/1c2b500c-90d3-4496-ad33-752bed07a597)

Works without issue on macOS & Linux in Bash.

### Expected

```
await $`mkdir -p ${path.join(__dirname, 'AA-zx-test')}`
```

working, as on other OS.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.