Skip to content

Commit f5bec80

Browse files
committed
internal/gocommand: show pid of process
We're almost certain that the go process shown by ps is not the one that we're waiting for in runCmdContext, but only by printing the pid can we be sure. Updates golang/go#54461 Change-Id: I1ce9580de6ee6bc4557d76c2a6b05f5a3e2eb6c2 Reviewed-on: https://go-review.googlesource.com/c/tools/+/434637 TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Alan Donovan <[email protected]> gopls-CI: kokoro <[email protected]> Reviewed-by: Robert Findley <[email protected]>
1 parent 19c47f1 commit f5bec80

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

internal/gocommand/invoke.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ func runCmdContext(ctx context.Context, cmd *exec.Cmd) error {
258258
case err := <-resChan:
259259
return err
260260
case <-time.After(1 * time.Minute):
261-
HandleHangingGoCommand()
261+
HandleHangingGoCommand(cmd.Process)
262262
case <-ctx.Done():
263263
}
264264
} else {
@@ -291,13 +291,13 @@ func runCmdContext(ctx context.Context, cmd *exec.Cmd) error {
291291
case err := <-resChan:
292292
return err
293293
case <-time.After(10 * time.Second): // a shorter wait as resChan should return quickly following Kill
294-
HandleHangingGoCommand()
294+
HandleHangingGoCommand(cmd.Process)
295295
}
296296
}
297297
return <-resChan
298298
}
299299

300-
func HandleHangingGoCommand() {
300+
func HandleHangingGoCommand(proc *os.Process) {
301301
switch runtime.GOOS {
302302
case "linux", "darwin", "freebsd", "netbsd":
303303
fmt.Fprintln(os.Stderr, `DETECTED A HANGING GO COMMAND
@@ -330,7 +330,7 @@ See golang/go#54461 for more details.`)
330330
panic(fmt.Sprintf("running %s: %v", listFiles, err))
331331
}
332332
}
333-
panic("detected hanging go command: see golang/go#54461 for more details")
333+
panic(fmt.Sprintf("detected hanging go command (pid %d): see golang/go#54461 for more details", proc.Pid))
334334
}
335335

336336
func cmdDebugStr(cmd *exec.Cmd) string {

0 commit comments

Comments
 (0)