bug: fix issues w/ closed connection not closing running process

This commit is contained in:
Will Owens 2025-10-26 08:58:19 -05:00
parent 71b9db14e2
commit c830287cb0
No known key found for this signature in database
GPG key ID: 8C8384B16B623DA6
4 changed files with 12 additions and 8 deletions

View file

@ -1,6 +1,7 @@
package localcommand
import (
"context"
"os"
"os/exec"
"syscall"
@ -28,8 +29,8 @@ type LocalCommand struct {
ptyClosed chan struct{}
}
func New(command string, argv []string, options ...Option) (*LocalCommand, error) {
cmd := exec.Command(command, argv...)
func New(ctx context.Context, command string, argv []string, options ...Option) (*LocalCommand, error) {
cmd := exec.CommandContext(ctx, command, argv...)
pty, err := pty.Start(cmd)
if err != nil {