Example #1
0
func RunCommand(w http.ResponseWriter, command string, args []string) {
	out, err := exec.Command(command, args...).Output()
	res := models.Response{Result: string(out), Status: 200}
	if err != nil {
		res.Status = 500
		res.Error = err.Error()
	}
	res.Respond(w)
}