inotify working, more responsive

This commit is contained in:
Neale Pickett 2014-08-13 05:21:19 +00:00
parent 2faee3164e
commit 2a0c9231d7
2 changed files with 8 additions and 1 deletions

View File

@ -30,7 +30,9 @@ func ReadString(fn string) string {
}
func tail(w http.ResponseWriter, pos int64) {
f, err := os.Open(path.Join(ServerDir, "log"))
logfn := path.Join(ServerDir, "log")
f, err := os.Open(logfn)
if err != nil {
log.Fatal(err)
}
@ -41,6 +43,7 @@ func tail(w http.ResponseWriter, pos int64) {
log.Fatal(err)
}
defer watcher.Close()
watcher.Add(logfn)
for {
printid := false

View File

@ -27,6 +27,10 @@ var gecos string
var logq chan Message
func isChannel(s string) bool {
if (s == "") {
return false
}
switch s[0] {
case '#', '&', '!', '+', '.', '-':
return true