On Windows with RStudio 2026.07.1:
rstudioapi::terminalSend(id, "echo BONJOUR\n")
writes the command but does not execute it.
Using \r instead does execute it:
rstudioapi::terminalSend(id, "echo BONJOUR\r")
This fixes the downstream harness issue for me:
main ← mitilyboony:fix/windows-rstudio-terminal
opened 09:15PM - 28 Sep 26 UTC
Fixes #7
## Summary
With RStudio 2026.07.1+147 on Windows, `rstudioapi::termin… alSend()` with a trailing `"\n"` inserts the command into the integrated terminal but does not submit it. Using `"\r"` correctly triggers execution.
This patch changes only the two command terminators in the Windows branch of `spawn_terminal()`: one for changing the working directory and one for starting the coding agent. Unix/macOS behavior is unchanged.
Upstream RStudio report: https://forum.posit.co/t/rstudioapi-terminalsend-inserts-newline-but-does-not-execute-command-on-windows/218495
## Verification
Manually tested in RStudio 2026.07.1+147 on Windows with R 4.4.2:
```r
devtools::load_all("C:/Users/jeanw/workspace/harness")
harness::launch("claude", role = "data-scientist")
```
Claude Code starts automatically in the integrated RStudio terminal without manually pressing Enter.
Local checks under R 4.4.2:
- `devtools::test(filter = "^launch$")`: 15 assertions passed, no failures.
- A targeted check with a mocked terminal API confirmed that `launch()` sends exactly two commands ending in CR (byte 13) to a `win-cmd` terminal.
- `git diff --check`: passed.
I’m not sure whether \n is still supposed to submit the command on Windows, since the rstudioapi docs still use \n in examples. Is this expected behavior with the current terminal backend?