Folder: *cfg,
}
+ s.log.Debugf("Event emit %s - ID=%s, Status=%s IsInSync=%v", EventEventType+evType, cfg.ID,
+ cfg.Status, cfg.IsInSync)
+
if err := (*so).Emit(EventEventType+evType, msg); err != nil {
s.log.Errorf("WS Emit Folder StateChanged event : %v", err)
}
// ExecArgs JSON parameters of /exec command
ExecArgs struct {
ID string `json:"id" binding:"required"`
- SdkID string `json:"sdkid"` // sdk ID to use for setting env
+ SdkID string `json:"sdkID"` // sdk ID to use for setting env
+ CmdID string `json:"cmdID"` // command unique ID
Cmd string `json:"cmd" binding:"required"`
Args []string `json:"args"`
Env []string `json:"env"`
}
// Unique ID for each commands
- cmdID := strconv.Itoa(execCommandID)
- execCommandID++
+ if args.CmdID == "" {
+ args.CmdID = s.cfg.ServerUID[:18] + "_" + strconv.Itoa(execCommandID)
+ execCommandID++
+ }
// Create new execution over WS context
- execWS := eows.New(strings.Join(cmd, " "), cmdArgs, sop, sess.ID, cmdID)
+ execWS := eows.New(strings.Join(cmd, " "), cmdArgs, sop, sess.ID, args.CmdID)
execWS.Log = s.log
// Append client project dir to environment
// MakeArgs is the parameters (json format) of /make command
type MakeArgs struct {
ID string `json:"id"`
- SdkID string `json:"sdkid"` // sdk ID to use for setting env
+ SdkID string `json:"sdkID"` // sdk ID to use for setting env
+ CmdID string `json:"cmdID"` // command unique ID
Args []string `json:"args"` // args to pass to make command
Env []string `json:"env"`
RPath string `json:"rpath"` // relative path into project
}
}
- cmdID := strconv.Itoa(makeCommandID)
- makeCommandID++
+ // Unique ID for each commands
+ if args.CmdID == "" {
+ args.CmdID = s.cfg.ServerUID[:18] + "_" + strconv.Itoa(makeCommandID)
+ makeCommandID++
+ }
cmd := []string{}
// Retrieve env command regarding Sdk ID
cmd = append(cmd, args.Args...)
}
- s.log.Debugf("Execute [Cmd ID %d]: %v", cmdID, cmd)
+ s.log.Debugf("Execute [Cmd ID %d]: %v", args.CmdID, cmd)
data := make(map[string]interface{})
data["ID"] = prj.ID
data["RootPath"] = prj.RootPath
data["ExitImmediate"] = args.ExitImmediate
- err := common.ExecPipeWs(cmd, args.Env, sop, sess.ID, cmdID, execTmo, s.log, oCB, eCB, &data)
+ err := common.ExecPipeWs(cmd, args.Env, sop, sess.ID, args.CmdID, execTmo, s.log, oCB, eCB, &data)
if err != nil {
common.APIError(c, err.Error())
return
c.JSON(http.StatusOK,
gin.H{
"status": "OK",
- "cmdID": cmdID,
+ "cmdID": args.CmdID,
})
}
f.fConfig = cfg
// Update Syncthing folder
- // (expect if status is ErrorConfig)
+ // (except if status is ErrorConfig)
// TODO: add cache to avoid multiple requests on startup
if f.fConfig.Status != folder.StatusErrorConfig {
id, err := f.st.FolderChange(f.fConfig)
Log: log,
}
+ c.Log.Infoln("Server UUID: ", uuid)
+
// config file settings overwrite default config
err = readGlobalConfig(&c, c.Options.ConfigFile)
if err != nil {
return nil, fmt.Errorf("Cannot create logs dir: %v", err)
}
}
- c.Log.Infoln("Logs file: ", c.Options.LogFile)
- c.Log.Infoln("Logs directory: ", c.FileConf.LogsDir)
+
+ c.Log.Infoln("Logs file: ", c.Options.LogFile)
+ c.Log.Infoln("Logs directory: ", c.FileConf.LogsDir)
return &c, nil
}
// No config file found
return nil
}
- c.Log.Infof("Use config file: %s", *cFile)
+ c.Log.Infof("Use config file: %s", *cFile)
// TODO move on viper package to support comments in JSON and also
// bind with flags (command line options)
}
ctx.Config.LogVerboseOut = fdLH
- logPrint(ctx, "Logging file for HTTP requests: %s\n", logFileHTTPReq)
+ logPrint(ctx, "Logging file for HTTP requests: %s\n", logFileHTTPReq)
}
// Create syncthing instance when section "syncthing" is present in config.json
--- /dev/null
+#!/bin/bash
+echo "1:STDOUT"
+>&2 echo "2:STDERR"
+echo "3:STDOUT"
+>&2 echo "4:STDERR"
+>&2 echo "5:STDERR"
+echo "6:STDOUT"