Skip to content

Fix: device-send.py works on Windows paths with spaces - #2697

Open
jonathanwardle1992-beep wants to merge 1 commit into
repeat98:mainfrom
jonathanwardle1992-beep:fix/device-send-windows-paths
Open

jonathanwardle1992-beep wants to merge 1 commit into
repeat98:mainfrom
jonathanwardle1992-beep:fix/device-send-windows-paths

Conversation

@jonathanwardle1992-beep

Copy link
Copy Markdown
Contributor

scripts/device-send.py now works on Windows when Node or the repository sits in a folder whose name contains a space. Before this fix, any line that drives the unit stopped before reaching the queue. Nothing changes on macOS or Linux, and nothing changes for musicians.

  • What was wrong or hard: With MODWERK_UNIT_TURN unset, the script runs itself again inside the unit queue with os.execv. On Windows os.execv joins its arguments without quoting them, so a Node path like C:\Users\Jo Doe\AppData\Local\nvm\…\node.EXE reached Node split in two. It failed with Cannot find module 'C:\…\Doe\AppData\Local\nvm\…\node.EXE'. This came up while testing a module on an Octatrack from a Windows user folder with a space. The workaround was to call node scripts/unit-queue.mjs run … -- python -B scripts/device-send.py LINE by hand.
  • What this changes: On Windows the script starts the queue with subprocess.Popen (list form, so each argument is quoted) and exits with the queue's code. Ctrl+C is left to the queue, which also receives it and rolls back in its own time; the script doesn't kill it. POSIX keeps os.execv.
  • How I checked it: The new scripts/device-send.test.mjs copies the script into a folder with spaces next to a stub unit-queue.mjs. The stub echoes its arguments and exits 3. The test checks that the line, the script path and a quoted argument arrive intact and that the exit code comes back. On Windows (Node 24.22, Python 3) it fails on main with the exact Cannot find module error and passes with this change. npm run pr:ready on this Windows machine: modules:compat needed PYTHONUTF8=1, a separate Windows encoding issue. The vitest run shows 128 Windows-only failures in files this PR doesn't touch, such as the device MCP, check.test.ts and the test procedure. CI on Linux is the gate. The assigned agent replay was completed.
  • Tested on a unit: Not tested on a unit: this changes no built package or base, only the host script that sends lines to the device server. The same command line ran against a real Octatrack through the manual unit-queue.mjs run workaround during Micro Timing: list 0.1.1-experimental (unit bss) #2193 testing.
  • Edge cases: none, because this changes no built package or base.
  • What the guides lacked or got wrong, and where I fixed it: nothing; the test now catches it.

🤖 Generated with Claude Code

On Windows os.execv joins its arguments unquoted, so a Node or repository
path with a space reached Node split in two. Start the unit queue with
subprocess there and exit with its code; POSIX keeps execv.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: jonathanwardle1992 <jonathanwardle1992@gmail.com>

This branch has not been deployed

No deployments
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