From 10d0bd8a17eacb5671e04388703428e3d7a18758 Mon Sep 17 00:00:00 2001 From: Iwasaki Yudai Date: Fri, 21 Aug 2015 12:33:44 +0900 Subject: [PATCH] Log PID of processes for clients --- app/app.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/app.go b/app/app.go index 178853f..6a42f88 100644 --- a/app/app.go +++ b/app/app.go @@ -110,6 +110,7 @@ func (app *App) generateHandler() func(w http.ResponseWriter, r *http.Request) { cmd := exec.Command(app.Command[0], app.Command[1:]...) fio, err := pty.Start(cmd) + log.Printf("Command is running for client %s with PID %d", r.RemoteAddr, cmd.Process.Pid) if err != nil { log.Print("Failed to execute command") return @@ -126,7 +127,7 @@ func (app *App) generateHandler() func(w http.ResponseWriter, r *http.Request) { for { size, err := utf8f.Read(buf) if err != nil { - log.Printf("command exited for: %s", r.RemoteAddr) + log.Printf("Command exited for: %s", r.RemoteAddr) return }