# error: signal: killed

- **ID:** `go/os-exec-command-killed`
- **Domain:** go
- **Category:** system_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The executed command was terminated by an operating system signal, typically SIGKILL, due to resource limits or manual intervention.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.20 | active | — | — |
| 1.21 | active | — | — |

## Workarounds

1. **Use exec.Cmd with SysProcAttr to set process group and handle signals** (85% success)
   ```
   cmd := exec.Command("command")
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
if err := cmd.Run(); err != nil {
    if exitErr, ok := err.(*exec.ExitError); ok {
        if status, ok := exitErr.Sys().(syscall.WaitStatus); ok {
            if status.Signaled() { /* handle signal */ }
        }
    }
}
   ```

## Dead Ends

- **Restarting the command without investigating** — May be killed again due to same resource issue; check OOM killer or ulimit. (70% fail)
