Skip to content

fix: use proper shell escaping for 'Executing:' command display #60

@gsong

Description

@gsong

Summary

The "Executing:" message in claude-launcher.ts:33 does not properly show escaped arguments, making it misleading when paths or arguments contain spaces or special characters.

Current State

The current implementation uses simple join with space to display the command:

console.log(`Executing: ${claudePath} ${args.join(" ")}`);

This does not reflect the actual shell escaping that is used during execution (line 40):

const command = `exec ${quote([claudePath, ...args])}`;

Problem

The display shows an unescaped command that may not be valid shell syntax, while the actual execution uses shell-quote for proper escaping.

Example:

  • Display shows: Executing: /path/to/claude --mcp-config /path with spaces/config.json
  • Actual execution: /path/to/claude --mcp-config '/path with spaces/config.json'

If a user tries to copy-paste the displayed command, it would fail because the arguments are not properly quoted.

Proposed Solution

Use the same quote function from shell-quote for the display to ensure consistency:

import { quote } from "shell-quote";

const displayCommand = quote([claudePath, ...args]);
console.log(`Executing: ${displayCommand}`);

Benefits

  • Accurate representation of what is actually being executed
  • Copy-pastable commands that work correctly
  • Consistency between display and execution logic
  • Better debugging experience for users

Files to Modify

  • src/claude-launcher.ts:33 - Update the console.log statement to use quote()

Notes

The quote function is already imported at line 2, so this is a simple one-line change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions