Fix native:jump hang on Windows and harden port detection#126
Merged
Conversation
- Drop killExistingServers cleanup step; rely on dynamic port selection so stale prior servers don't block a fresh run. - Strengthen isPortInUse() with a bind-test alongside the connect-test so ports held but not accepting (stuck Windows servers, TIME_WAIT) aren't mistaken for free. - Fix startBridgeServer() on Windows: the trailing `&` is a command separator there, not a background operator, so exec() blocked forever on the long-lived bridge server and the QR never rendered. Use `start "" /B ... >> log 2>&1` via popen/pclose to detach properly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Closed
|
This fixed the QR problem 🥇 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.





Summary
Fixes a report from a Windows user that
php artisan native:jumpgot stuck after printing the Laravel server line, never rendering the QR code.Three related fixes in
src/Commands/JumpCommand.php:Drop the
killExistingServerscleanup step. With reliable dynamic port selection in place, we don't need to hunt and kill prior processes — and the cleanup never reliably caught strayartisan serveinstances anyway. Also removes the noisy "Cleaning up N existing server(s)" line.Harden
isPortInUse()with a bind-test alongside the existing connect-test.fsockopenonly detects ports that are accepting connections; it misses ports held but not listening (stuck/half-dead Windows servers,TIME_WAIT, bound-but-not-listening). That's why a stale previousartisan serveon 8000 could fool the old check into selecting 8000 again. We now also trystream_socket_serverand treat a bind failure as in-use.Fix the actual Windows hang in
startBridgeServer(). The bridge spawn used a trailing&to background the websocket server, which is Unix shell syntax. On Windows,&is a command separator — not a background operator — soexec()blocked forever on the long-lived bridge server, which is why the QR code never appeared. Windows now usesstart "" /B ... >> log 2>&1viapopen/pclosefor a proper detached spawn; Unix path is unchanged.Test plan
php artisan native:jumpstill starts, picks ports, shows QR, and the bridge log fills as the phone connects.php artisan native:jumpreaches the QR display without hanging, even when a priorartisan serveis still running on 8000.php artisan native:jumprepeatedly without manually killing prior servers — each run picks fresh ports and starts cleanly.🤖 Generated with Claude Code