Commit 10d0bd8a by Iwasaki Yudai

Log PID of processes for clients

1 parent fd4a9d3b
Showing with 2 additions and 1 deletions
...@@ -110,6 +110,7 @@ func (app *App) generateHandler() func(w http.ResponseWriter, r *http.Request) { ...@@ -110,6 +110,7 @@ func (app *App) generateHandler() func(w http.ResponseWriter, r *http.Request) {
cmd := exec.Command(app.Command[0], app.Command[1:]...) cmd := exec.Command(app.Command[0], app.Command[1:]...)
fio, err := pty.Start(cmd) fio, err := pty.Start(cmd)
log.Printf("Command is running for client %s with PID %d", r.RemoteAddr, cmd.Process.Pid)
if err != nil { if err != nil {
log.Print("Failed to execute command") log.Print("Failed to execute command")
return return
...@@ -126,7 +127,7 @@ func (app *App) generateHandler() func(w http.ResponseWriter, r *http.Request) { ...@@ -126,7 +127,7 @@ func (app *App) generateHandler() func(w http.ResponseWriter, r *http.Request) {
for { for {
size, err := utf8f.Read(buf) size, err := utf8f.Read(buf)
if err != nil { if err != nil {
log.Printf("command exited for: %s", r.RemoteAddr) log.Printf("Command exited for: %s", r.RemoteAddr)
return return
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!