Bug: Cursor CLI script fails to handle arguments with spaces and special characters correctly due to unsafe eval usage

Where does the bug appear (feature/product)?

Cursor CLI

Describe the Bug

The use_cursor_cli function in /Applications/Cursor.app/Contents/Resources/app/bin/code uses eval "$CURSOR_CLI" "$@" which causes incorrect argument parsing when arguments contain spaces, quotes, or other special characters.

Issue Details

  • Location: use_cursor_cli function, line 22: eval "$CURSOR_CLI" "$@"
  • Problem: eval re-parses the command line, which can break proper argument handling for arguments containing spaces, quotes, backslashes, or shell metacharacters like $, !, etc.

Steps to Reproduce

  • Arguments with spaces: cursor "my file.txt" might be parsed incorrectly

Operating System

MacOS

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.2.20
VSCode Version: 1.105.1
Commit: b3573281c4775bfc6bba466bf6563d3d498d1070
Date: 2025-12-12T06:29:26.017Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Darwin arm64 25.2.0

Additional Information

Suggested Fix

Replace eval "$CURSOR_CLI" "$@" with direct command execution:

ELECTRON_RUN_AS_NODE=1 "$ELECTRON" "$CLI" "$@"

This properly preserves argument boundaries while handling arguments with spaces correctly.

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

1 Like

Hey, thanks for the report.

This is a known issue. The team is aware of the bug and working on a fix.

Your solution with replacing eval with direct command execution looks correct.

Temporary workaround - avoid files with spaces in names when using CLI, or open them from inside Cursor.

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.