aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Cholewiński <harry666t@gmail.com>2017-03-06 18:22:57 +0100
committerKamil Cholewiński <harry666t@gmail.com>2017-03-14 18:20:24 +0100
commitd1abc564afee6d197f818e471ac766e6bb9e759a (patch)
treee3fe3e3915b5c05771856651166f82d7b415176f
parentb9cba62b225668236e90e6cc2fd6342f1a11be91 (diff)
downloadjudo-d1abc564afee6d197f818e471ac766e6bb9e759a.zip
judo-d1abc564afee6d197f818e471ac766e6bb9e759a.tar.gz
judo-d1abc564afee6d197f818e471ac766e6bb9e759a.tar.bz2
master code panics fixed?
-rw-r--r--libjudo/host.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/libjudo/host.go b/libjudo/host.go
index 685208a..eda5287 100644
--- a/libjudo/host.go
+++ b/libjudo/host.go
@@ -105,14 +105,22 @@ func (host *Host) StartMaster() (err error) {
host.master = proc
go func() {
close(host.master.Stdin())
- for {
+ for host.master != nil {
select {
- case line := <-host.master.Stdout():
+ case line, ok := <-host.master.Stdout():
+ if !ok {
+ continue
+ }
host.Log(line)
- case line := <-host.master.Stderr():
+ case line, ok := <-host.master.Stderr():
+ if !ok {
+ continue
+ }
host.Log(line)
case err = <-host.master.Done():
- host.Log(err.Error())
+ if err != nil {
+ host.Log(err.Error())
+ }
host.master = nil
case <-host.cancel:
host.StopMaster()