Ignoring EINTR (ctrl+Z) signal

This commit is contained in:
Andy Ouyang 2015-08-03 14:38:42 -07:00 committed by Benoit Sigoure
parent b155fc13d4
commit 0b9f044bb3
1 changed files with 6 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import (
"log" "log"
"os" "os"
"sync" "sync"
"syscall"
"github.com/hpcloud/tail/util" "github.com/hpcloud/tail/util"
@ -113,8 +114,12 @@ func (shared *InotifyTracker) run() {
case err, open := <-shared.watcher.Error: case err, open := <-shared.watcher.Error:
if !open { if !open {
return return
} else if err != nil {
sysErr, ok := err.(*os.SyscallError)
if !ok || sysErr.Err != syscall.EINTR {
logger.Printf("Error in Watcher Error channel: %s", err)
}
} }
logger.Printf("Error in Watcher Errors channel: %s", err)
case <-shared.done: case <-shared.done:
return return