package webcmd import ( "fmt" "net/http" "time" ) func (this *App) Serve_TaskInfo(w http.ResponseWriter, task_ref string) { this.tasksMtx.RLock() taskinfo, ok := this.tasks[task_ref] this.tasksMtx.RUnlock() if !ok { http.Error(w, "Unknown task.", 404) return } w.Header().Set("Content-Type", "text/html;charset=UTF-8") w.WriteHeader(200) this.ServePartial_Header(w, "/taskinfo/...") fmt.Fprintf(w, ` `) for _, line := range taskinfo.output { messageClass := "stdout" if line.isError { messageClass = "stderr" } fmt.Fprintf(w, ` `, messageClass, hesc(line.text), ) } fmt.Fprintf(w, `
Message
%s
`, hesc(task_ref), ) this.ServePartial_Footer(w) }