Skip to content

Add signal() method to ProcessLibrary for sending signals to processes#2017

Merged
KCarretto merged 2 commits intomainfrom
claude/implement-process-signal-4Vz1Z
Mar 3, 2026
Merged

Add signal() method to ProcessLibrary for sending signals to processes#2017
KCarretto merged 2 commits intomainfrom
claude/implement-process-signal-4Vz1Z

Conversation

@hulto
Copy link
Collaborator

@hulto hulto commented Mar 3, 2026

What type of PR is this?

/kind feature
/kind eldritch-function

What this PR does / why we need it:

This PR adds a new signal() method to the ProcessLibrary that allows sending signals to processes by their process ID. This enables Eldritch scripts to terminate or control processes programmatically.

Key changes:

  • Added signal(pid: i64, signal: i64) method to the ProcessLibrary trait
  • Implemented Unix/Linux support using libc::kill() with native signal numbers
  • Implemented Windows support using sysinfo crate, supporting signals 2 (SIGINT), 9 (SIGKILL), and 15 (SIGTERM)
  • Added comprehensive documentation describing parameters, return values, and platform-specific behavior
  • Implemented stub for fake library for testing
  • Added unit tests for both Unix and Windows implementations

The method provides a cross-platform interface for process signaling, with appropriate error handling for cases like process not found, permission denied, or unsupported signals on Windows.

Which issue(s) this PR fixes:

Fixes #2012

https://claude.ai/code/session_01NnhY1itaJniUekeFZrWChT

Implements process.signal(pid, signal) per issue #2012.

On Unix (Linux, macOS, BSD), delegates directly to libc::kill() with the
raw platform-native signal integer, so caller-supplied numbers map to the
correct OS signal on each platform without any translation layer.

On Windows, maps the common POSIX signal integers (2/SIGINT, 9/SIGKILL,
15/SIGTERM) to sysinfo Signal variants backed by TerminateProcess; other
values return a descriptive error.

https://claude.ai/code/session_01NnhY1itaJniUekeFZrWChT
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2731    ±0 2731    ±0 0    ±0 0    ±0 0    ±0 0    ±0 1ms    ±0

Previous Results

Build 🏗️ Result 🧪 Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
#1475 2731 2731 0 0 0 0 43.4s

Insights

Average Tests per Run Total Flaky Tests Total Failed Slowest Test (p95)
2731 0 0 5.5s

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
TestDockerExecutor_Build_ContextCancellation 1 5.5s 5.5s
eldritch-libsys: std::dll_inject_impl::tests::test_dll_inject_simple 1 5.2s 5.2s
TestInteractiveShell 1 5.1s 5.1s
TestOtherStreamOutput 1 5.0s 5.0s
imix::bin/imix: install::tests::test_install_execution 3 1.7s 4.9s
imix::bin/imix: install::tests::test_install_execution 3 1.7s 4.9s
imix::bin/imix: install::tests::test_install_execution 3 1.7s 4.9s
imix::bin/imix: tests::task_tests::test_task_streaming_output 3 3.0s 3.0s
imix::bin/imix: tests::task_tests::test_task_streaming_output 3 3.0s 3.0s
imix::bin/imix: tests::task_tests::test_task_streaming_output 3 3.0s 3.0s

🎉 No failed tests in this run. | 🍂 No flaky tests in this run.

Github Test Reporter by CTRF 💚

🔄 This comment has been updated

@KCarretto KCarretto added this pull request to the merge queue Mar 3, 2026
Merged via the queue into main with commit 0bf6859 Mar 3, 2026
9 checks passed
@KCarretto KCarretto deleted the claude/implement-process-signal-4Vz1Z branch March 3, 2026 20:51
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.

[feature] process.signal eldritch

3 participants