diff --git a/engine/NetStart.go b/engine/NetStart.go index bafec1ee0f..5ee0cae261 100644 --- a/engine/NetStart.go +++ b/engine/NetStart.go @@ -493,10 +493,9 @@ func NetStart(s *state.State, p *FactomParams, listenToStdin bool) { RegisterPrometheus() go controlPanel.ServeControlPanel(fnodes[0].State.ControlPanelChannel, fnodes[0].State, connectionMetricsChannel, p2pNetwork, Build) - // Listen for commands: - if !p.disableSimControl { - SimControl(p.ListenTo, listenToStdin) - } + + SimControl(p.ListenTo, listenToStdin) + } //********************************************************************** diff --git a/engine/factomParams.go b/engine/factomParams.go index b53155834b..5c2edfee07 100644 --- a/engine/factomParams.go +++ b/engine/factomParams.go @@ -53,7 +53,7 @@ type FactomParams struct { pluginPath string torManage bool torUpload bool - disableSimControl bool + Sim_Stdin bool exposeProfiling bool } @@ -109,7 +109,7 @@ func ParseCmdLine(args []string) *FactomParams { superVerboseMessages := flag.Bool("svm", false, "If true, print out every single message as you receive it.") - disableSimControlPtr := flag.Bool("nosim", false, "Using this flag disables sim control") + sim_stdinPtr := flag.Bool("sim_stdin", true, "If true, sim control reads from stdin.") // Plugins pluginPath := flag.String("plugin", "", "Input the path to any plugin binaries") @@ -161,7 +161,7 @@ func ParseCmdLine(args []string) *FactomParams { p.fastLocation = *fastLocationPtr p.loglvl = *logLvlPtr p.logjson = *logJsonPtr - p.disableSimControl = *disableSimControlPtr + p.Sim_Stdin = *sim_stdinPtr p.exposeProfiling = *exposeProfilePtr p.svm = *superVerboseMessages diff --git a/engine/simControl.go b/engine/simControl.go index adbf76efbf..e626ef4330 100644 --- a/engine/simControl.go +++ b/engine/simControl.go @@ -42,13 +42,13 @@ var InputChan = make(chan string) // Get commands here func GetLine(listenToStdin bool) string { if listenToStdin { - l := make([]byte, 100) + line := make([]byte, 100) var err error // When running as a detatched process, this routine becomes a very tight loop and starves other goroutines. // So, we will sleep before letting it check to see if Stdin has been reconnected for { - if _, err = os.Stdin.Read(l); err == nil { - return string(l) + if _, err = os.Stdin.Read(line); err == nil { + return string(line) } else { if err == io.EOF { fmt.Printf("Error reading from std, sleeping for 5s: %s\n", err.Error()) diff --git a/factomd.go b/factomd.go index 1796ff2b08..85006a1ee3 100644 --- a/factomd.go +++ b/factomd.go @@ -15,7 +15,8 @@ import ( func main() { // uncomment StartProfiler() to run the pprof tool (for testing) params := engine.ParseCmdLine(os.Args[1:]) - state := engine.Factomd(params, true) + sim_Stdin := params.Sim_Stdin + state := engine.Factomd(params, sim_Stdin) for state.Running() { time.Sleep(time.Second) }