Skip to content

fix: windows dev script quoting and set trailing space#893

Open
kylegrahammatzen wants to merge 1 commit intouseautumn:devfrom
kylegrahammatzen:fix/windows-dev-script
Open

fix: windows dev script quoting and set trailing space#893
kylegrahammatzen wants to merge 1 commit intouseautumn:devfrom
kylegrahammatzen:fix/windows-dev-script

Conversation

@kylegrahammatzen
Copy link
Collaborator

@kylegrahammatzen kylegrahammatzen commented Mar 6, 2026

Summary

Fix Windows dev script quoting by passing commands as array args to concurrently instead of through cmd /c

Windows didn't like cmd /c mangling inner double quotes, causing bun dev to fail when setting up the repository.

Related Issues

Follow-up to #397

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactor
  • Other (please describe):

Checklist

  • I have read the CONTRIBUTING.md
  • My code follows the code style of this project
  • I have added tests where applicable
  • I have tested my changes locally
  • I have linked relevant issues
  • I have added screenshots for UI changes (if applicable)

Additional Context

Tested on Windows 11 and WSL Ubuntu 24.04 where WSL had bunx not found from a fresh install so verifying on macOS is needed.


Summary by cubic

Fix Windows dev script quoting by invoking bun x concurrently directly with array args instead of cmd/sh wrappers. Prevents bun dev, workers, Vite, and checkout dev servers from failing on Windows.

  • Bug Fixes
    • Call bun x concurrently directly and pass each command as its own arg to avoid quote mangling and platform-specific duplication.
    • Remove spaces before && in Windows set to prevent trailing spaces in env values (SERVER_PORT, VITE_PORT, CHECKOUT_PORT).

Written for commit 5558002. Summary will update on new commits.

Greptile Summary

This PR fixes two Windows-specific issues in the bun dev script: shell quote mangling caused by wrapping the concurrently invocation in cmd /c, and a trailing-space bug in Windows set variable assignments. The fix unifies both platforms by spawning bunx concurrently directly as an array argument to Bun.spawn, with each sub-command passed as its own element rather than as a single shell-escaped string.

Key changes:

  • Bug fixes — Replaced Bun.spawn(["cmd", "/c", bunx concurrently ... "${cmd1}" "${cmd2}"]) with Bun.spawn(["bunx", "concurrently", ..., cmd1, cmd2]) on both Windows and Unix, eliminating cmd /c double-quote mangling that broke bun dev on Windows.
  • Bug fixes — Changed set SERVER_PORT=${SERVER_PORT} && bun devset SERVER_PORT=${SERVER_PORT}&& bun dev (removing the space before &&). In Windows cmd.exe the set command captures all characters up to the next unescaped &, so the old form stored a trailing space in the variable value; the new form does not.
  • Improvements — Removed the now-redundant duplication in the workers:dev push (isWindows ? "..." : "..." where both branches were identical) by using a single platform-agnostic string.

Confidence Score: 4/5

  • Safe to merge after macOS/Linux verification; Windows fix is logically sound and tested.
  • The architectural change (dropping cmd /c / sh -c wrappers in favour of direct Bun.spawn with array args) is correct and the Windows set trailing-space fix is valid cmd.exe syntax. The only gap is that the author explicitly noted macOS verification is still needed — the Unix path is simpler than before so failure is unlikely, but it has not been confirmed yet.
  • scripts/dev.ts — needs a macOS/Linux smoke-test since the Unix spawn path also changed from sh -c to direct bunx invocation.

Important Files Changed

Filename Overview
scripts/dev.ts Refactors Bun.spawn call to invoke bunx concurrently directly with commands as separate array arguments, eliminating the cmd /c / sh -c wrapper that caused Windows quote mangling; also removes trailing spaces from set VAR=value &&set VAR=value&& on Windows.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[bun dev / scripts/dev.ts] --> B{serverOnly?}

    B -- yes --> C{isWindows?}
    C -- yes --> D["serverCmd = 'cd server && set SERVER_PORT=PORT&& bun start'"]
    C -- no --> E["serverCmd = 'cd server && SERVER_PORT=PORT bun start'"]
    D & E --> F["Bun.spawn(['bunx','concurrently','-n','server,workers','-c','green,yellow', serverCmd, workersCmd])"]

    B -- no --> G{isWindows?}
    G -- yes --> H["cmds = ['cd server && set SERVER_PORT=PORT&& bun dev', ...]"]
    G -- no --> I["cmds = ['cd server && SERVER_PORT=PORT bun dev', ...]"]
    H & I --> J["Bun.spawn(['bunx','concurrently','-n',names,'-c',colors,...cmds])"]

    F --> K[concurrently spawns each cmd via system shell]
    J --> K
Loading

Last reviewed commit: 70d829b

Greptile also left 1 inline comment on this PR.

@vercel
Copy link

vercel bot commented Mar 6, 2026

@kylegrahammatzen is attempting to deploy a commit to the Autumn Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

];
}
const serverCmd = isWindows
? `cd server && set SERVER_PORT=${SERVER_PORT}&& bun start`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentional && placement — worth a comment

The absence of a space before && is intentional and correct: in Windows cmd.exe, the set command captures every character after = up to the next unescaped &, so set SERVER_PORT=8080 && ... stores "8080 " (trailing space) while set SERVER_PORT=8080&& ... stores "8080". This is easy to misread as a typo and silently revert. A short inline comment would help future maintainers:

Suggested change
? `cd server && set SERVER_PORT=${SERVER_PORT}&& bun start`
? `cd server && set SERVER_PORT=${SERVER_PORT}&& bun start` // no space before && (avoids trailing space in value)
Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/dev.ts
Line: 99

Comment:
**Intentional `&&` placement — worth a comment**

The absence of a space before `&&` is intentional and correct: in Windows `cmd.exe`, the `set` command captures every character after `=` up to the next unescaped `&`, so `set SERVER_PORT=8080 && ...` stores `"8080 "` (trailing space) while `set SERVER_PORT=8080&& ...` stores `"8080"`. This is easy to misread as a typo and silently revert. A short inline comment would help future maintainers:

```suggestion
			? `cd server && set SERVER_PORT=${SERVER_PORT}&& bun start` // no space before && (avoids trailing space in value)
```

How can I resolve this? If you propose a fix, please make it concise.

@kylegrahammatzen kylegrahammatzen force-pushed the fix/windows-dev-script branch from 70d829b to 5558002 Compare March 6, 2026 14:46
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.

1 participant