Skip to content

Commit

Permalink
refactor: [SyslogRelay] remove the return value of the stop
Browse files Browse the repository at this point in the history
  • Loading branch information
electricbubble committed Apr 24, 2021
1 parent b6b9bb3 commit d73a058
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
7 changes: 3 additions & 4 deletions device.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,12 +457,11 @@ func (d *device) Syslog() (lines <-chan string, err error) {
return d.syslogRelay.Lines(), nil
}

func (d *device) SyslogStop() (err error) {
if _, err = d.syslogRelayService(); err != nil {
return err
func (d *device) SyslogStop() {
if d.syslogRelay == nil {
return
}
d.syslogRelay.Stop()
return nil
}

func (d *device) XCTest(bundleID string) (out <-chan string, cancel context.CancelFunc, err error) {
Expand Down
7 changes: 3 additions & 4 deletions device_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ func Test_device_AppUninstall(t *testing.T) {
func Test_device_Syslog(t *testing.T) {
setupLockdownSrv(t)

dev.SyslogStop()

lines, err := dev.Syslog()
if err != nil {
t.Fatal(err)
Expand All @@ -137,9 +139,6 @@ func Test_device_Syslog(t *testing.T) {

// <-done
time.Sleep(3 * time.Second)
err = dev.SyslogStop()
if err != nil {
t.Fatal(err)
}
dev.SyslogStop()
time.Sleep(200 * time.Millisecond)
}
2 changes: 1 addition & 1 deletion idevice.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type Device interface {

syslogRelayService() (syslogRelay SyslogRelay, err error)
Syslog() (lines <-chan string, err error)
SyslogStop() (err error)
SyslogStop()

XCTest(bundleID string) (out <-chan string, cancel context.CancelFunc, err error)
}
Expand Down

0 comments on commit d73a058

Please sign in to comment.