@@ -14,6 +14,7 @@ import (
1414 "runtime"
1515 "strings"
1616 "sync"
17+ "syscall"
1718
1819 "github.com/wavetermdev/waveterm/pkg/utilds"
1920 "github.com/wavetermdev/waveterm/pkg/wavebase"
@@ -300,7 +301,7 @@ func (c *TsunamiController) SendInput(input *BlockInputUnion) error {
300301}
301302
302303func runTsunamiAppBinary (ctx context.Context , appBinPath string ) (* TsunamiAppProc , error ) {
303- cmd := exec .CommandContext ( ctx , appBinPath , "--close-on-stdin" )
304+ cmd := exec .Command ( appBinPath , "--close-on-stdin" )
304305
305306 stdoutPipe , err := cmd .StdoutPipe ()
306307 if err != nil {
@@ -338,6 +339,22 @@ func runTsunamiAppBinary(ctx context.Context, appBinPath string) (*TsunamiAppPro
338339 // Start goroutine to handle cmd.Wait()
339340 go func () {
340341 tsunamiProc .WaitRtn = cmd .Wait ()
342+ log .Printf ("WAIT RETURN: %v\n " , tsunamiProc .WaitRtn )
343+ if err := tsunamiProc .WaitRtn ; err != nil {
344+ if ee , ok := err .(* exec.ExitError ); ok {
345+ if ws , ok := ee .ProcessState .Sys ().(syscall.WaitStatus ); ok {
346+ if ws .Signaled () {
347+ sig := ws .Signal ()
348+ log .Printf ("tsunami proc killed by signal: %s (%d)" , sig , int (sig ))
349+ } else {
350+ log .Printf ("tsunami proc exited with code %d" , ee .ExitCode ())
351+ }
352+ }
353+ } else {
354+ log .Printf ("tsunami proc error: %v" , err )
355+ }
356+ }
357+
341358 close (waitCh )
342359 }()
343360
@@ -354,6 +371,7 @@ func runTsunamiAppBinary(ctx context.Context, appBinPath string) (*TsunamiAppPro
354371 errChan <- fmt .Errorf ("stderr buffer error: %w" , err )
355372 return
356373 }
374+ log .Printf ("[stderr-readline] %s\n " , line )
357375
358376 port := build .ParseTsunamiPort (line )
359377 if port > 0 {
0 commit comments