Skip to content

[bug] Nushell does not correctly evaluate custom task commands #2156

@siew24

Description

@siew24

Describe the bug

When a command is provided to a task, the evaluation behaviour of the command from nushell causes it to have unintended consequences. The below reproduction steps describe what I'm experiencing:

Steps to reproduce

  1. Create a folder named bugged
  2. cd bugged
  3. Run moon init
  4. Create apps/app/moon.yml file from the root workspace with the following content:
tasks:
  bug:
    command: "bunx envinfo"
  1. Run moon app:bug
  2. The following output will be shown:
Error: nu::parser::parse_mismatch

  × Parse mismatch during operation.
   ╭─[source:1:8]
 1 │ 'bunx' 'envinfo'
   ·        ────┬────
   ·            ╰── expected operator
   ╰────

▪▪▪▪ app:bug
▪▪▪▪ app:bug (7ms)
Error: task_runner::run_failed

  × Task app:bug failed to run.
  ╰─▶ Process bunx failed: exit code 1

Expected behavior

The above steps should produce the output described from the Environment section below.

Screenshots

Environment

bunx envinfo
  System:
    OS: macOS 26.1
    CPU: (10) arm64 Apple M4
    Memory: 450.59 MB / 16.00 GB
    Shell: 0.107.0 - /opt/homebrew/bin/nu
  Binaries:
    Node: 24.9.0 - /opt/homebrew/bin/node
    npm: 11.6.0 - /opt/homebrew/bin/npm
    bun: 1.2.22 - ~/.proto/tools/bun/1.2.22/bun
    Watchman: 2025.09.15.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.15.2 - /usr/local/bin/pod
    Homebrew: 4.6.15 - /opt/homebrew/bin/brew
    pip3: 21.2.4 - /usr/bin/pip3
    RubyGems: 3.0.3.1 - /usr/bin/gem
  Utilities:
    CMake: 4.1.1 - /opt/homebrew/bin/cmake
    Make: 3.81 - /usr/bin/make
    GCC: 17.0.0 - /usr/bin/gcc
    Git: 2.50.1 - /usr/bin/git
    Clang: 17.0.0 - /usr/bin/clang
    FFmpeg: 8.0 - /opt/homebrew/bin/ffmpeg
    Curl: 8.7.1 - /usr/bin/curl
    OpenSSL: 3.3.6 - /usr/bin/openssl
  Servers:
    Apache: 2.4.62 - /usr/sbin/apachectl
  Virtualization:
    Docker: 28.3.3 - /usr/local/bin/docker
    Docker Compose: 2.39.2 - /usr/local/bin/docker-compose
  SDKs:
    iOS SDK:
      Platforms: DriverKit 25.0, iOS 26.0, macOS 26.0, tvOS 26.0, visionOS 26.0, watchOS 26.0
    Android SDK:
      API Levels: 35
      Build Tools: 35.0.0
  IDEs:
    Android Studio: 2025.1 AI-251.25410.109.2511.13665796
    VSCode: 1.103.2 - /usr/local/bin/code
    Vim: 9.1 - /usr/bin/vim
    Xcode: 26.0.1/17A400 - /usr/bin/xcodebuild
  Languages:
    Bash: 3.2.57 - /bin/bash
    Go: 1.25.1 - /opt/homebrew/bin/go
    Elixir: 1.17.3 - /Users/siew24/.asdf/shims/elixir
    Erlang: 27.1.2 - /Users/siew24/.asdf/shims/erl
    Java: 23.0.1 - /usr/bin/javac
    Perl: 5.34.1 - /usr/bin/perl
    Protoc: 32.1 - /opt/homebrew/bin/protoc
    Python: 3.13.7 - /opt/homebrew/bin/python
    Python3: 3.9.6 - /usr/bin/python3
    Ruby: 2.6.10 - /usr/bin/ruby
  Databases:
    SQLite: 3.51.0 - /usr/bin/sqlite3
  Browsers:
    Chrome: 140.0.7339.214
    Safari: 26.1

Additional Context

I have tried switching from nushell to a different shell (e.g. Zsh) but it seems that moon runs commands based on the system shell, not the current shell (correct me if I'm wrong)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions