}
// Allow to pass id in url (/exec/:id) or as JSON argument
- id := c.Param("id")
- if id == "" {
- id = args.ID
+ idArg := c.Param("id")
+ if idArg == "" {
+ idArg = args.ID
}
- if id == "" {
+ if idArg == "" {
common.APIError(c, "Invalid id")
return
}
-
+ id, err := s.mfolders.ResolveID(idArg)
+ if err != nil {
+ common.APIError(c, err.Error())
+ return
+ }
f := s.mfolders.Get(id)
if f == nil {
common.APIError(c, "Unknown id")
}
}
- cmd = append(cmd, "cd", fld.GetFullPath(args.RPath))
+ cmd = append(cmd, "cd", "\""+fld.GetFullPath(args.RPath)+"\"")
// FIXME - add 'exec' prevents to use syntax:
// xds-exec -l debug -c xds-config.env -- "cd build && cmake .."
// but exec is mandatory to allow to pass correctly signals
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