Skip to content

fix(sdk): populate pane process/exit state in Window::info snapshots - #253

Open
mrmflis-hub wants to merge 1 commit into
Helvesec:mainfrom
mrmflis-hub:fix/sdk-window-info-live-pane-state
Open

mrmflis-hub wants to merge 1 commit into
Helvesec:mainfrom
mrmflis-hub:fix/sdk-window-info-live-pane-state

Conversation

@mrmflis-hub

Copy link
Copy Markdown

Window::info()'s snapshot hard-coded PaneProcessState::Unknown for every listed pane, even though the daemon already serves the live per-pane details (running pid, dead flag, exit status/signal, start command, start path) that Pane::info()'s snapshot surfaces. Consumers polling the window-level snapshot could therefore never observe a pane exit, and no window-level caller could read a pane's working directory either.

Decorate the window snapshot with one additional session-scoped list-panes probe using the same 18-field format the pane-scoped snapshot uses, reusing the existing details parser and state derivation:

  • a pane whose probe line reports dead gets Exited plus its exit state (status code, signal);
  • a running pane gets Running with its pid, start command, working directory, geometry, and lifecycle counters;
  • a pane whose line the probe cannot resolve keeps Unknown, so a pane that vanished mid-snapshot degrades exactly like the pane-scoped absent-slot snapshot;
  • an already-closed error from the probe degrades to the undecorated snapshot, matching the pane listing's own tolerance.

Verified with the scripted transport test in window/tests.rs and end-to-end from a downstream app against a live Windows daemon (a cmd /c exit 3 pane now reports exit code 3 through Window::info).

Window::info()'s snapshot hard-coded PaneProcessState::Unknown for every
listed pane, even though the daemon already serves the live per-pane
details (running pid, dead flag, exit status/signal, start command,
start path) that Pane::info()'s snapshot surfaces. Consumers polling the
window-level snapshot could therefore never observe a pane exit, and no
window-level caller could read a pane's working directory either.

Decorate the window snapshot with one additional session-scoped
list-panes probe using the same 18-field format the pane-scoped snapshot
uses, reusing the existing details parser and state derivation:

- a pane whose probe line reports dead gets Exited plus its exit state
  (status code, signal);
- a running pane gets Running with its pid, start command, working
  directory, geometry, and lifecycle counters;
- a pane whose line the probe cannot resolve keeps Unknown, so a pane
  that vanished mid-snapshot degrades exactly like the pane-scoped
  absent-slot snapshot;
- an already-closed error from the probe degrades to the undecorated
  snapshot, matching the pane listing's own tolerance.

Verified with the scripted transport test in window/tests.rs and
end-to-end from a downstream app against a live Windows daemon (a
cmd /c exit 3 pane now reports exit code 3 through Window::info).

Signed-off-by: mrmflis-hub <mr.mflis@gmail.com>

This branch has not been deployed

No deployments
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