Add logging; don't relay signal from stub after seeing EOF.

This commit is contained in:
Qi Xiao 2016-02-22 23:06:00 +01:00
parent e6c44bdbdd
commit 60ea1ffb35
4 changed files with 6 additions and 1 deletions

View File

@ -20,6 +20,7 @@ func (ed *Editor) appendHistory(line string) {
// TODO(xiaq): Report possible error
ed.store.AddCmd(line)
ed.store.Waits.Done()
Logger.Println("added cmd to store:", line)
}()
}
}

View File

@ -385,6 +385,7 @@ func cdInner(dir string, ec *EvalCtx) {
// XXX Error ignored.
store.AddDir(pwd)
store.Waits.Done()
Logger.Println("added dir to store:", pwd)
}()
}
}

View File

@ -5,7 +5,7 @@ type BadSignal struct {
}
func (bs BadSignal) String() string {
return "bad signal:" + bs.Error.Error()
return "bad signal: " + bs.Error.Error()
}
func (BadSignal) Signal() {}

View File

@ -122,6 +122,9 @@ func relaySignals(reader io.Reader, sigch chan<- os.Signal) {
_, err := fmt.Fscanf(reader, "%d", &signum)
if err != nil {
sigch <- BadSignal{err}
if err == io.EOF {
break
}
} else {
sigch <- syscall.Signal(signum)
}