Skip to content

Conversation

@leosuncin
Copy link
Contributor

It ocurred to me that the script generated by running mise activate pwsh throws an error because my user home contains whitespace and the generated script didn't escape them.

A portion of the current generated script:

    if ($arguments.count -eq 0) {
        & C:\Users\User Home\AppData\Local\Microsoft\WinGet\Links\mise.exe
        _reset_output_encoding
        return
    } elseif ($arguments -contains '-h' -or $arguments -contains '--help') {
        & C:\Users\User Home\AppData\Local\Microsoft\WinGet\Links\mise.exe @arguments
        _reset_output_encoding
        return
    }

Which cause the error:

&:
Line |
  64 |          & C:\Users\User Home\AppData\Local\Microsoft\WinGet\Lin …
     |            ~~~~~~~~~~~~~~
     | The term 'C:\Users\User' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

To fix it the executable path should be wrapped with quotes in every ocassion

    if ($arguments.count -eq 0) {
        & "C:\Users\User Home\AppData\Local\Microsoft\WinGet\Links\mise.exe"
        _reset_output_encoding
        return
    } elseif ($arguments -contains '-h' -or $arguments -contains '--help') {
        & "C:\Users\User Home\AppData\Local\Microsoft\WinGet\Links\mise.exe" @arguments
        _reset_output_encoding
        return
    }

Copilot AI review requested due to automatic review settings November 17, 2025 01:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug in the PowerShell activation script where paths containing whitespace cause errors. The executable path is now wrapped in double quotes in all invocations using the call operator &.

  • Wrapped {exe} with double quotes in all PowerShell & operator calls to handle paths with spaces

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jdx jdx merged commit 730bdc1 into jdx:main Nov 17, 2025
26 checks passed
@leosuncin leosuncin deleted the fix/wrap-exe-path-with-quotes branch November 17, 2025 20:39
jdx pushed a commit that referenced this pull request Nov 18, 2025
### 📦 Registry

- add tbls by @artemklevtsov in
[#6987](#6987)

### 🐛 Bug Fixes

- **(nushell)** add missing `| parse env | update-env` for deactivation
operations by @jokeyrhyme in
[#6994](#6994)
- **(pwsh)** wrap the executable path with double quotes by @leosuncin
in [#6993](#6993)
- in `activate bash` output, wrap mise executable path in single-quotes
by @cspotcode in [#7002](#7002)

### 📚 Documentation

- simplify apt instructions by @scop in
[#6986](#6986)
- update idiomatic version files enablement info by @scop in
[#6985](#6985)

### 🧪 Testing

- **(aqua)** remove biome test due to version incompatibility by @jdx in
[#7000](#7000)

### 📦️ Dependency Updates

- lock file maintenance by @renovate[bot] in
[#6997](#6997)

### New Contributors

- @jokeyrhyme made their first contribution in
[#6994](#6994)
- @cspotcode made their first contribution in
[#7002](#7002)
- @artemklevtsov made their first contribution in
[#6987](#6987)
- @leosuncin made their first contribution in
[#6993](#6993)

## 📦 Aqua Registry Updates

#### New Packages (1)

-
[`houseabsolute/omegasort`](https://github.com/houseabsolute/omegasort)

#### Updated Packages (5)

- [`apache/maven`](https://github.com/apache/maven)
- [`chaqchase/lla`](https://github.com/chaqchase/lla)
- [`leoafarias/fvm`](https://github.com/leoafarias/fvm)
- [`rustic-rs/rustic`](https://github.com/rustic-rs/rustic)
- [`sigstore/rekor`](https://github.com/sigstore/rekor)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants