Skip to content

Commit 1453829

Browse files
justin808claude
andcommitted
Improve bin/dev kill error handling for process termination
Enhance the terminate_processes method to distinguish between ESRCH (process already stopped) and EPERM (permission denied) errors, providing clearer feedback to users when process termination fails. Key improvements: - Separate handling for ESRCH vs EPERM exceptions - User warning when permission is denied for a process - Clearer indication of what actually happened during process termination This change aligns with the pattern implemented in react_on_rails-demos PR #42 for better process management. Fixes #1858 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 2b5bab8 commit 1453829

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/react_on_rails/dev/server_manager.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,12 @@ def find_process_pids(pattern)
7070
def terminate_processes(pids)
7171
pids.each do |pid|
7272
Process.kill("TERM", pid)
73-
rescue StandardError
73+
rescue Errno::ESRCH
74+
# Process already stopped - this is fine
7475
nil
76+
rescue Errno::EPERM
77+
# Permission denied - warn the user
78+
puts " ⚠️ Process #{pid} - permission denied (process owned by another user)"
7579
end
7680
end
7781

0 commit comments

Comments
 (0)