Skip to content

rtk err loses argument quoting (breaks node -e / python3 -c) and exits 0 on failure #2985

Closed as duplicate

Description

@cboydstun

Description

rtk err <cmd> appears to re-join its argv into a single string and hand it to sh -c, which loses the original argument quoting. Any argument containing shell metacharacters — most commonly node -e '...' or python3 -c '...' — is re-split by the shell and fails with a syntax error.

Worse, the failure is reported as exit 0, so a caller (or an agent) sees a "successful" run that never actually executed the command.

Repro steps

rtk err node -e 'console.log("a")'

Actual:

sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `node -e console.log("a")'
echo $?   # -> 0

Note the echoed command in the error: the single quotes around console.log("a") are gone, so sh sees the parentheses as unquoted metacharacters.

Running the same command directly works fine:

node -e 'console.log("a")'   # -> a

Expected

Two things:

  1. rtk err should preserve argument boundaries — exec the argv directly rather than reconstructing a shell string (or shell-quote each argument before passing to sh -c).
  2. It should propagate the child's exit code. A command that failed to run must not exit 0.

Actual

Quoting is lost, the command never runs, and the exit status is 0.

Impact

rtk err is the recommended wrapper for commands RTK has no dedicated filter for — which is exactly the population of commands most likely to carry -e / -c / quoted arguments. The silent exit-0 makes this especially bad for agents, which will treat the failure as a success.

Version / environment

  • rtk 0.43.0, macOS arm64 (Darwin 24.6.0)

Note

The exit-code half may share a root cause with #2974 (pnpm/eslint exit code swallowed); the quoting loss looks independent.

Activity

  1. pszymkowiak commented on Jul 14, 2026

    @pszymkowiak
    Collaborator

    wshm · Automated triage by AI

    🔍 Automated Triage

    🐛 Category bug
    🟠 Priority high
    🎯 Confidence 93%

    Summary

    rtk err rejoins argv into a shell string (losing quoting on node -e/python3 -c style args) and reports exit 0 even when the command never ran; should exec argv directly and propagate the child's real exit code.

    📁 Relevant files
    • src/err_cmd.rs

    Triaged automatically by wshm · This is an automated analysis, not a human review.

  2. albatrossflyon-coder commented on Jul 15, 2026

    @albatrossflyon-coder
    Contributor

    Hi! I'd like to work on this one. Could you assign it to me?

  3. KuSh commented on Sep 13, 2026

    @KuSh
    Collaborator

    Closing as a duplicate of #2389, which tracks the same problem with the more complete discussion. Please follow up there; if your case differs in a way that issue does not cover, comment here and it can be reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions