Log stub events.

Doesn't seem to work though :(
This commit is contained in:
Qi Xiao 2016-02-23 18:22:24 +01:00
parent 0fc6c01077
commit 4d63220e14

View File

@ -12,6 +12,7 @@ import (
"github.com/elves/elvish/util" "github.com/elves/elvish/util"
) )
var Logger = util.GetLogger("[stub] ")
var stubname = "elvish-stub" var stubname = "elvish-stub"
type Stub struct { type Stub struct {
@ -130,6 +131,7 @@ func relaySignals(reader io.Reader, sigch chan<- os.Signal) {
for { for {
var signum int var signum int
_, err := fmt.Fscanf(reader, "%d", &signum) _, err := fmt.Fscanf(reader, "%d", &signum)
Logger.Println("signal:", signum, err)
if err != nil { if err != nil {
sigch <- BadSignal{err} sigch <- BadSignal{err}
if err == io.EOF { if err == io.EOF {
@ -144,6 +146,7 @@ func relaySignals(reader io.Reader, sigch chan<- os.Signal) {
func wait(proc *os.Process, ch chan<- struct{}) { func wait(proc *os.Process, ch chan<- struct{}) {
for { for {
state, err := proc.Wait() state, err := proc.Wait()
Logger.Println("wait:", state, err)
if err != nil || state.Exited() { if err != nil || state.Exited() {
break break
} }