Skip to content

Commit 4af7db7

Browse files
mclasmeierMoritz Clasmeier
andauthored
Send SIGKILL to failed port-forwarding process and simplify (#174)
Co-authored-by: Moritz Clasmeier <mclasmeier@redhat.com>
1 parent b706834 commit 4af7db7

1 file changed

Lines changed: 1 addition & 6 deletions

File tree

internal/portforward/portforward.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,8 @@ func (m *Manager) Start(namespace, serviceName string, remotePort, preferredLoca
100100

101101
// Wait for port to be ready
102102
if !m.waitTCPReady("127.0.0.1", localPort, 20.0) {
103-
// Kill the process group
104103
if cmd.Process != nil {
105-
pgid, err := syscall.Getpgid(cmd.Process.Pid)
106-
if err == nil {
107-
syscall.Kill(-pgid, syscall.SIGTERM)
108-
}
109-
// TODO(ROX-34499): AFAICT this can get stuck forever if the process blocks SIGTERM...
104+
cmd.Process.Kill()
110105
cmd.Wait()
111106
}
112107
return "", fmt.Errorf("port-forward did not become ready")

0 commit comments

Comments
 (0)