func TerminalUpdate(writer http.ResponseWriter, request *http.Request) {
	setHeaders(writer)
	userMut.Lock()
	_, user, err := getUser(writer, request)

	if err == nil {
		output := readString(user.in)
		errorOutput := readString(user.err)

		response := Result{Stdout: output, Stderr: errorOutput}
		bytes, err := json.Marshal(response)

		if err != nil {
			http.Error(writer, err.Error(), http.StatusInternalServerError)
		} else {
			writer.Write(bytes)
		}

		writeLog(request.RemoteAddr, map[string]interface{}{
			"Time":   time.Now(),
			"Stdout": output,
			"Stderr": errorOutput,
		})
	}
	userMut.Unlock()
}
// report output from the terminal
report output from the terminal
// report output from the terminal
func TerminalUpdate(writer http.ResponseWriter, request *http.Request) {
	setHeaders(writer)
	userMut.Lock()
	_, user, err := getUser(writer, request)
	if err == nil {
		output := readString(user.in)
		errorOutput := readString(user.err)
		response := Result{Stdout: output, Stderr: errorOutput}
		bytes, err := json.Marshal(response)
		if err != nil {
			http.Error(writer, err.Error(), http.StatusInternalServerError)
		} else {
			writer.Write(bytes)
		}
		writeLog(request.RemoteAddr, map[string]interface{}{
			"Time":   time.Now(),
			"Stdout": output,
			"Stderr": errorOutput,
		})
	}
	userMut.Unlock()
}
func TerminalUpdate ( writer http . ResponseWriter , request * http . Request ) { setHeaders ( writer ) userMut . Lock ( ) _ , user , err := getUser ( writer , request ) if err == nil { output := readString ( user . in ) errorOutput := readString ( user . err ) response := Result { Stdout : output , Stderr : errorOutput } bytes , err := json . Marshal ( response ) if err != nil { http . Error ( writer , err . Error ( ) , http . StatusInternalServerError ) } else { writer . Write ( bytes ) } writeLog ( request . RemoteAddr , map [ string ] interface { } { " " : time . Now ( ) , " " : output , " " : errorOutput , } ) } userMut . Unlock ( ) }
report output from the terminal
report output from the terminal