# terminal: Kill entire process group on Unix when stopping command \(\#45993\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/01b716cf12199c82b480e5f2a7afb12128d273a4)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 01b716cf12199c82b480e5f2a7afb12128d273a4

Requested commit: 01b716cf12199c82b480e5f2a7afb12128d273a4

Commit: 01b716cf12199c82b480e5f2a7afb12128d273a4

Tree: d53473ba11991297b5583086fc39f75837ced5dc

Author: Serhii Melnychuk

Committer: GitHub

## Message

```
terminal: Kill entire process group on Unix when stopping command (#45993)

## Problem

When clicking Stop button on a terminal tool call (or using terminal
kill bindings), only the shell process was killed. Child processes (like
`sleep`, `npm run`, etc.) continued running as orphans.

## Solution

On Unix, use `killpg()` instead of `sysinfo::Process::kill()` to
terminate the entire foreground process group.

`tcgetpgrp()` already returns the foreground process group ID, so
`killpg()` is the correct syscall to use here.

## Testing

1. Run a long command in terminal tool (e.g. `sleep 30`)
2. Click Stop button
3. Verify with `ps aux | grep sleep` that the process is actually killed

## Notes

- This fix is Unix-only (Linux, macOS)
- Windows behavior unchanged — may need separate investigation with Job
Objects

## Release Notes

- Fixed terminal Stop button not killing child processes on Unix (Linux,
macOS)
```

## Parents

- [7e8310a4297fa8b074db9d9b3f74a2757b618616](https://git.cafe/gitcafe/zed/commit/7e8310a4297fa8b074db9d9b3f74a2757b618616?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/01b716cf12199c82b480e5f2a7afb12128d273a4?format=markdown)
