+ // Build command line
+ cmd := []string{}
+ // Setup env var regarding Sdk ID (used for example to setup cross toolchain)
+ if envCmd := s.sdks.GetEnvCmd(args.SdkID, prj.DefaultSdk); len(envCmd) > 0 {
+ cmd = append(cmd, envCmd...)
+ cmd = append(cmd, "&&")
+ } else {
+ // It's an error if no envcmd found while a sdkid has been provided
+ if args.SdkID != "" {
+ common.APIError(c, "Unknown sdkid")
+ return
+ }
+ }
+
+ // FIXME - SEB: exec prevents to use syntax:
+ // xds-exec -l debug -c xds-config.env -- "cd build && cmake .."
+ cmd = append(cmd, "cd", prj.GetFullPath(args.RPath))
+ cmd = append(cmd, "&&", "exec", args.Cmd)
+
+ // Process command arguments
+ cmdArgs := make([]string, len(args.Args)+1)
+ copy(cmdArgs, args.Args)
+
+ // Allocate pts if tty if used
+ if args.TTY {
+ gdbPty, gdbTty, err = pty.Open()
+ if err != nil {
+ common.APIError(c, err.Error())
+ return
+ }
+
+ s.log.Debugf("Client command tty: %v %v\n", gdbTty.Name(), gdbTty.Name())
+ cmdArgs = append(cmdArgs, "--tty="+gdbTty.Name())
+ }
+
+ // Unique ID for each commands
+ cmdID := strconv.Itoa(execCommandID)
+ execCommandID++
+
+ // Create new execution over WS context
+ execWS := eows.New(strings.Join(cmd, " "), cmdArgs, sop, sess.ID, cmdID)
+ execWS.Log = s.log
+
+ // Append client project dir to environment
+ execWS.Env = append(args.Env, "CLIENT_PROJECT_DIR="+prj.RelativePath)
+
+ // Set command execution timeout
+ if args.CmdTimeout == 0 {