Skip to content

Remove exit pipe monitoring on Unix#219

Merged
adamsitnik merged 3 commits intomainfrom
copilot/remove-exit-pipe-logic
Feb 16, 2026
Merged

Remove exit pipe monitoring on Unix#219
adamsitnik merged 3 commits intomainfrom
copilot/remove-exit-pipe-logic

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 16, 2026

Removes exit pipe infrastructure from Unix process spawning and waiting. Exit pipe provided redundant process exit monitoring on platforms that already have kqueue (macOS/FreeBSD) or pidfd (Linux).

Changes

Managed layer (SafeChildProcessHandle.Unix.cs):

  • Removed _exitPipeFd field and related buffer
  • Updated constructor and all wait methods to eliminate exit pipe parameter
  • Simplified ReleaseHandle() to only close pidfd

Native layer (pal_process.c):

  • Removed exit pipe creation from spawn_process() in both posix_spawn and fork/exec paths
  • Updated try_wait_for_exit(), try_wait_for_exit_cancellable(), and wait_for_exit_or_kill_on_timeout() to use only kqueue or pidfd
  • Returns ENOTSUP on platforms without kqueue or pidfd support for wait operations with timeout/cancellation

Process monitoring after change

  • macOS/FreeBSD: kqueue with EVFILT_PROC
  • Linux: pidfd with poll
  • Other Unix: ENOTSUP for timed/cancellable waits

Net reduction: 96 lines

Original prompt

This section details on the original issue you should resolve

<issue_title>Remove all the logic related to "exit pipe" on Unix</issue_title>
<issue_description>- Remove all the code related to "exit pipe" on Unix:
- from the managed layer, including:

private static readonly byte[] s_exitPipeBuffer = new byte[1];

private readonly int _exitPipeFd;


- from the native layer, including:
- the spawn_process method:
int* out_exit_pipe_fd,

// Create pipe for exit monitoring (CLOEXEC to avoid other parallel processes inheriting it)
if (create_cloexec_pipe(exit_pipe) != 0) {
return -1;
}

- for other native methods like try_wait_for_exit_cancellable, try_wait_for_exit, wait_for_exit_or_kill_on_timeout, remove the int exitPipeFd argument and when neither HAVE_KQUEUE or HAVE_PIDFD are defined, set errno = ENOTSUP; and return.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 16, 2026 10:40
Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove all logic related to exit pipe on Unix Remove exit pipe monitoring on Unix Feb 16, 2026
Copilot AI requested a review from adamsitnik February 16, 2026 10:46
@adamsitnik adamsitnik marked this pull request as ready for review February 16, 2026 10:46
Copy link
Copy Markdown
Owner

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

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

LGTM!

@adamsitnik adamsitnik merged commit 3eb2258 into main Feb 16, 2026
3 checks passed
@adamsitnik adamsitnik deleted the copilot/remove-exit-pipe-logic branch February 16, 2026 10:46
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.

Remove all the logic related to "exit pipe" on Unix

2 participants