CmdTimeout int `json:"timeout"` // command completion timeout in Second
}
+ // ExecRes JSON result of /exec command
+ ExecRes struct {
+ Status string `json:"status"` // status OK
+ CmdID string `json:"cmdID"` // command unique ID
+ }
+
+ // ExecSigRes JSON result of /signal command
+ ExecSigRes struct {
+ Status string `json:"status"` // status OK
+ CmdID string `json:"cmdID"` // command unique ID
+ }
+
// ExecInMsg Message used to received input characters (stdin)
ExecInMsg struct {
CmdID string `json:"cmdID"`
execWS.ExitCB = func(e *eows.ExecOverWS, code int, err error) {
s.log.Debugf("Command [Cmd ID %s] exited: code %d, error: %v", e.CmdID, code, err)
+ // Close client tty
+ defer func() {
+ if gdbPty != nil {
+ gdbPty.Close()
+ }
+ if gdbTty != nil {
+ gdbTty.Close()
+ }
+ }()
+
// IO socket can be nil when disconnected
so := s.sessions.IOSocketGet(e.Sid)
if so == nil {
}
time.Sleep(time.Second)
}
- }
-
- // Close client tty
- if gdbPty != nil {
- gdbPty.Close()
- }
- if gdbTty != nil {
- gdbTty.Close()
+ s.log.Debugf("OK file are synchronized.")
}
// FIXME replace by .BroadcastTo a room
return
}
- c.JSON(http.StatusOK,
- gin.H{
- "status": "OK",
- "cmdID": execWS.CmdID,
- })
+ c.JSON(http.StatusOK, ExecRes{Status: "OK", CmdID: execWS.CmdID})
}
// ExecCmd executes remotely a command
return
}
- c.JSON(http.StatusOK,
- gin.H{
- "status": "OK",
- })
+ c.JSON(http.StatusOK, ExecSigRes{Status: "OK", CmdID: args.CmdID})
}