From ff3546a844497797d4baf4df883087ce92a9bea3 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Sun, 19 May 2019 01:25:41 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20kill=20=E5=91=BD=E4=BB=A4=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- session/processes.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/session/processes.go b/session/processes.go index 6f18bcb..253477f 100644 --- a/session/processes.go +++ b/session/processes.go @@ -167,6 +167,7 @@ func RunHandler(w http.ResponseWriter, r *http.Request, channel map[string]*util after := time.After(5 * time.Second) channelRet["cmd"] = "run-done" + kill := false select { case <-after: if conf.Docker { @@ -179,12 +180,13 @@ func RunHandler(w http.ResponseWriter, r *http.Request, channel map[string]*util } channelRet["output"] = "run program timeout in 5s\n" + kill = true case <-done: channelRet["output"] = "\nrun program complete\n" } Processes.Remove(wSession, cmd.Process) - logger.Debugf("User [%s, %s] done running [id=%s, file=%s]", wSession.UserId, sid, rid, filePath) + logger.Debugf("User [%s, %s] done running [id=%s, file=%s, kill=%v]", wSession.UserId, sid, rid, filePath, kill) if nil != wsChannel { wsChannel.WriteJSON(&channelRet)