Skip to content

spacetime dev - Print feedback when client process exits#4469

Open
clockwork-labs-bot wants to merge 2 commits intomasterfrom
bot/dev-client-exit-feedback
Open

spacetime dev - Print feedback when client process exits#4469
clockwork-labs-bot wants to merge 2 commits intomasterfrom
bot/dev-client-exit-feedback

Conversation

@clockwork-labs-bot
Copy link
Collaborator

The main event loop in spacetime dev blocked on file change events with no periodic check on the client process. If the client exited (e.g., user pressed Enter in the basic-rs template), spacetime dev gave no feedback at all.

Fix: Switch from blocking recv() to recv_timeout(1s) and check client process status every second. On exit, prints:

  • Client process exited. File watcher is still active. (exit code 0)
  • Warning: Client process exited with code N. File watcher is still active. (non-zero)

The file watcher continues running so module changes are still detected and published.

The main event loop blocked on file change events with no periodic check
on the client process. If the client exited (e.g., user pressed Enter in
the basic-rs template), spacetime dev gave no feedback.

Now checks the client process status every second. On exit, prints:
- 'Client process exited. File watcher is still active.' (success)
- 'Warning: Client process exited with code N. File watcher is still active.' (failure)

The file watcher continues running so module changes are still detected.
@@ -751,7 +751,7 @@ pub async fn exec(mut config: Config, args: &ArgMatches) -> Result<(), anyhow::E
.and_then(|c| c.get_one::<String>("server").ok().flatten());
Copy link
Collaborator

Choose a reason for hiding this comment

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

@bfops bfops changed the title Print feedback when client process exits during spacetime dev spacetime dev - Print feedback when client process exits Feb 26, 2026
Copy link
Collaborator

@bfops bfops left a comment

Choose a reason for hiding this comment

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

LGTM:

     Running `target/debug/zeke_test`
Press any key to exit...
Connected to SpacetimeDB
Subscripted to the person table


Client process exited with code 0. File watcher is still active.

File change detected, rebuilding...

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