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"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="Go" enabled="true" />
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/embedded" />
|
||||
|
||||
3
.idea/workspace.xml
generated
3
.idea/workspace.xml
generated
@@ -5,7 +5,10 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<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$/server.go" beforeDir="false" afterPath="$PROJECT_DIR$/server.go" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<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"`
|
||||
Done chan bool `json:"-" yaml:"-" xml:"-"`
|
||||
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
|
||||
report *TestReport
|
||||
outputStream io.ReadCloser
|
||||
@@ -498,16 +499,16 @@ func (c *Client) Start() (err error) {
|
||||
return err
|
||||
}
|
||||
c.Running = true
|
||||
if c.Debug {
|
||||
//go func() {
|
||||
// ds := DebugScanner{Silent: false}
|
||||
// ds.Scan(c.outputStream)
|
||||
//}()
|
||||
//go func() {
|
||||
// ds := DebugScanner{Silent: false}
|
||||
// ds.Scan(c.errorStream)
|
||||
//}()
|
||||
}
|
||||
|
||||
go func() {
|
||||
ds := DebugScanner{Silent: !c.StdOut}
|
||||
ds.Scan(c.outputStream)
|
||||
}()
|
||||
go func() {
|
||||
ds := DebugScanner{Silent: !c.Debug}
|
||||
ds.Scan(c.errorStream)
|
||||
}()
|
||||
|
||||
go func() {
|
||||
var reporter *Reporter
|
||||
if c.live {
|
||||
|
||||
@@ -42,7 +42,8 @@ type Server struct {
|
||||
Running bool `json:"running" yaml:"running" xml:"running"`
|
||||
Options *ServerOptions `json:"-" yaml:"-" xml:"-"`
|
||||
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"`
|
||||
errorStream io.ReadCloser `json:"error_stream" yaml:"error_stream" xml:"error_stream"`
|
||||
cancel context.CancelFunc `json:"cancel" yaml:"cancel" xml:"cancel"`
|
||||
@@ -80,7 +81,7 @@ func (s *Server) commandString() (cmd string, err error) {
|
||||
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())
|
||||
}
|
||||
|
||||
@@ -160,14 +161,16 @@ func (s *Server) Start() (err error) {
|
||||
return err
|
||||
}
|
||||
s.Running = true
|
||||
|
||||
go func() {
|
||||
ds := DebugScanner{Silent: !s.Debug}
|
||||
ds := DebugScanner{Silent: !s.StdOut}
|
||||
ds.Scan(s.outputStream)
|
||||
}()
|
||||
go func() {
|
||||
ds := DebugScanner{Silent: !s.Debug}
|
||||
ds.Scan(s.errorStream)
|
||||
}()
|
||||
|
||||
go func() {
|
||||
exitCode := <-exit
|
||||
s.ExitCode = &exitCode
|
||||
|
||||
Reference in New Issue
Block a user