Repository navigation
π End port share cleanly on Ctrl+C and hide the editor's ports - #36
Merged
Merged
Conversation
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.
Description
Two fixes to
ws-cli port, found while recording the docs' port-share GIF.port shareon Ctrl+C: the command exited without printing anything, so the shell showed^C%.It now ends the line and confirms the share ended:
The port already went private when the stream closed (ws-server releases the share on close); only the output changes.
If Ctrl+C comes before the server confirms the share, the line just ends: nothing claims a port went private that never went public.
serve current --shareshares the same output.port listshowed the editor's own ports: the server port and the extension host's random ports were listed beside the user's.A port is now left out when it is the configured server port (
server.port), or when every socket listening on it belongs to a process whose executable is under/usr/lib/workspace/(the editor, its extension host and helpers).Processes started from the integrated terminal run other executables, so they stay listed; a socket whose owner cannot be read counts as the user's.
The MCP
port_listtool runs the same command, so it gets the same list.What type of PR is this? (check all that apply)
How to test this PR
go test ./...: includes SIGINT/SIGTERM after a confirmed share, Ctrl+C before confirmation, and editor-port detection against a fake/proc.ws-cli port share 8000and press Ctrl+C: the last line isβ Port 8000 is private again.ws-cli port list: 8080 and the extension host's ports are gone, ports opened from the terminal remain.Step 2 needs a workspace image whose editor supports
/ports/share; it was checked against ws-server's source and a fake server, not a live share.