Skip to content

Fix start.ps1: PowerShell will not parse a multi-line ternary - #9

Merged
peans99 merged 3 commits into
mainfrom
fix-start-ternary
Aug 21, 2026
Merged

Fix start.ps1: PowerShell will not parse a multi-line ternary#9
peans99 merged 3 commits into
mainfrom
fix-start-ternary

Conversation

@peans99

@peans99 peans99 commented Aug 21, 2026

Copy link
Copy Markdown
Owner

.\start.ps1 failed immediately with:

start.ps1: The term ':' is not recognized as a name of a cmdlet, function, script file, or executable program.

My fault, introduced when the launcher was taught to start the single executable. The choice between the app and the bare server was written as a ternary split over three lines:

$app = $NoOverlay
    ? 'src\...\Quantumwake.Server.exe'
    : 'src\...\QuantumWake.exe'

PowerShell ends the statement at the newline, then meets ? and : as commands. A ternary has to be on one line, or carry backtick continuations. Replaced with an if/else expression, which reads better at this width regardless.

Checked two ways rather than eyeballed this time: [Parser]::ParseFile reports no errors, and start.ps1 was actually run - it builds, starts the app, and the dashboard answers on 127.0.0.1:31337.

Only affects running from source. The released QuantumWake.exe never touches this script.

peans99 and others added 3 commits August 21, 2026 12:47
nekron ran the launcher and got "The term ':' is not recognized as a name of a
cmdlet". My fault, from the change that taught it to launch the single
executable: I wrote the choice as a ternary broken across three lines, and
PowerShell ends the statement at the newline, then meets `? '...'` and `:
'...'` as commands. It parses only on one line or with backtick continuations,
neither of which is worth it here.

An if/else expression instead, which reads better at this width anyway.

Checked two ways this time rather than eyeballed: the file is run through
[Parser]::ParseFile, which reports no errors, and start.ps1 was executed - it
builds, starts the app, and the dashboard answers.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
nekron hit "Build failed." with nothing else to go on. The cause was a leftover
Quantumwake.Server process of mine holding its own assemblies open, so MSBuild
could not overwrite them - nothing to do with the code, and the script gave no
way to know that, because it pipes the build to Out-Null and throws a bare
string.

Two changes, both about the same failure.

The script now stops any running QuantumWake or Quantumwake.Server before
building. A launcher exists to start the app; leaving the previous copy running
to break the build is not a service to anyone.

And when the build does fail, the error lines are printed. A bare "Build failed."
sends you looking at your own last edit when the reason is a file lock, a missing
SDK or a syntax error sitting in the output that was thrown away.

Verified by reproducing it: started a server to lock the build, ran start.ps1,
and watched it report "Stopping 1 running instance(s) first", build, and serve
the dashboard.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
"When we stop the server it doesn't kill the widget." Correct, and the script was
lying about who was in charge.

It ended on Wait-Process with a finally that killed the child, and printed
"Press Ctrl+C to stop the server". That made sense when the server was a
separate hidden process the console had launched. It stopped making sense when
the server moved inside QuantumWake.exe: the thing being waited on is now the
whole application - tray icon, overlay and server together - and PowerShell does
not guarantee the finally runs on Ctrl+C or when the terminal is closed. So the
window went away, the widget stayed, and the message had promised otherwise.

The app owns itself now. It has a tray icon with Quit and it holds the server
inside its own process, so the launcher builds it, starts it, opens the
dashboard and returns to the prompt, saying that the window can be closed and
where the quit button is.

-NoOverlay keeps the old behaviour, because it should: the bare server has no
tray icon and no window, so that console really is the only way to stop it.

Verified: the script now exits by itself, and the app is still running after it
does.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@peans99
peans99 merged commit 96702e8 into main Aug 21, 2026
1 check passed
peans99 added a commit that referenced this pull request Aug 28, 2026
Fix start.ps1: PowerShell will not parse a multi-line ternary
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