rework debug/stdout flags
This commit is contained in:
1
.idea/go-iperf.iml
generated
1
.idea/go-iperf.iml
generated
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module type="WEB_MODULE" version="4">
|
<module type="WEB_MODULE" version="4">
|
||||||
|
<component name="Go" enabled="true" />
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<excludeFolder url="file://$MODULE_DIR$/embedded" />
|
<excludeFolder url="file://$MODULE_DIR$/embedded" />
|
||||||
|
|||||||
3
.idea/workspace.xml
generated
3
.idea/workspace.xml
generated
@@ -5,7 +5,10 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="fc2840de-29dc-4fca-8e0e-a283562f60ca" name="Default Changelist" comment="">
|
<list default="true" id="fc2840de-29dc-4fca-8e0e-a283562f60ca" name="Default Changelist" comment="">
|
||||||
|
<change beforePath="$PROJECT_DIR$/.idea/go-iperf.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/go-iperf.iml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/client.go" beforeDir="false" afterPath="$PROJECT_DIR$/client.go" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/client.go" beforeDir="false" afterPath="$PROJECT_DIR$/client.go" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/server.go" beforeDir="false" afterPath="$PROJECT_DIR$/server.go" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
|||||||
23
client.go
23
client.go
@@ -66,7 +66,8 @@ type Client struct {
|
|||||||
Running bool `json:"running" yaml:"running" xml:"running"`
|
Running bool `json:"running" yaml:"running" xml:"running"`
|
||||||
Done chan bool `json:"-" yaml:"-" xml:"-"`
|
Done chan bool `json:"-" yaml:"-" xml:"-"`
|
||||||
Options *ClientOptions `json:"options" yaml:"options" xml:"options"`
|
Options *ClientOptions `json:"options" yaml:"options" xml:"options"`
|
||||||
Debug bool `json:"-" yaml:"-" xml:"-"`
|
Debug bool `json:"-" yaml:"-" xml:"-"`
|
||||||
|
StdOut bool `json:"-" yaml:"-" xml:"-"`
|
||||||
exitCode *int
|
exitCode *int
|
||||||
report *TestReport
|
report *TestReport
|
||||||
outputStream io.ReadCloser
|
outputStream io.ReadCloser
|
||||||
@@ -498,16 +499,16 @@ func (c *Client) Start() (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
c.Running = true
|
c.Running = true
|
||||||
if c.Debug {
|
|
||||||
//go func() {
|
go func() {
|
||||||
// ds := DebugScanner{Silent: false}
|
ds := DebugScanner{Silent: !c.StdOut}
|
||||||
// ds.Scan(c.outputStream)
|
ds.Scan(c.outputStream)
|
||||||
//}()
|
}()
|
||||||
//go func() {
|
go func() {
|
||||||
// ds := DebugScanner{Silent: false}
|
ds := DebugScanner{Silent: !c.Debug}
|
||||||
// ds.Scan(c.errorStream)
|
ds.Scan(c.errorStream)
|
||||||
//}()
|
}()
|
||||||
}
|
|
||||||
go func() {
|
go func() {
|
||||||
var reporter *Reporter
|
var reporter *Reporter
|
||||||
if c.live {
|
if c.live {
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ type Server struct {
|
|||||||
Running bool `json:"running" yaml:"running" xml:"running"`
|
Running bool `json:"running" yaml:"running" xml:"running"`
|
||||||
Options *ServerOptions `json:"-" yaml:"-" xml:"-"`
|
Options *ServerOptions `json:"-" yaml:"-" xml:"-"`
|
||||||
ExitCode *int `json:"exit_code" yaml:"exit_code" xml:"exit_code"`
|
ExitCode *int `json:"exit_code" yaml:"exit_code" xml:"exit_code"`
|
||||||
Debug bool `json:"-" yaml:"-" xml:"-"`
|
Debug bool `json:"-" yaml:"-" xml:"-"`
|
||||||
|
StdOut bool `json:"-" yaml:"-" xml:"-"`
|
||||||
outputStream io.ReadCloser `json:"output_stream" yaml:"output_stream" xml:"output_stream"`
|
outputStream io.ReadCloser `json:"output_stream" yaml:"output_stream" xml:"output_stream"`
|
||||||
errorStream io.ReadCloser `json:"error_stream" yaml:"error_stream" xml:"error_stream"`
|
errorStream io.ReadCloser `json:"error_stream" yaml:"error_stream" xml:"error_stream"`
|
||||||
cancel context.CancelFunc `json:"cancel" yaml:"cancel" xml:"cancel"`
|
cancel context.CancelFunc `json:"cancel" yaml:"cancel" xml:"cancel"`
|
||||||
@@ -80,7 +81,7 @@ func (s *Server) commandString() (cmd string, err error) {
|
|||||||
builder.WriteString(" --json")
|
builder.WriteString(" --json")
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.Options.LogFile != nil && s.LogFile() != "" {
|
if s.Options.LogFile != nil && s.LogFile() != "" {
|
||||||
fmt.Fprintf(&builder, " --logfile %s --forceflush", s.LogFile())
|
fmt.Fprintf(&builder, " --logfile %s --forceflush", s.LogFile())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,14 +161,16 @@ func (s *Server) Start() (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
s.Running = true
|
s.Running = true
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
ds := DebugScanner{Silent: !s.Debug}
|
ds := DebugScanner{Silent: !s.StdOut}
|
||||||
ds.Scan(s.outputStream)
|
ds.Scan(s.outputStream)
|
||||||
}()
|
}()
|
||||||
go func() {
|
go func() {
|
||||||
ds := DebugScanner{Silent: !s.Debug}
|
ds := DebugScanner{Silent: !s.Debug}
|
||||||
ds.Scan(s.errorStream)
|
ds.Scan(s.errorStream)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
exitCode := <-exit
|
exitCode := <-exit
|
||||||
s.ExitCode = &exitCode
|
s.ExitCode = &exitCode
|
||||||
|
|||||||
Reference in New Issue
Block a user