Skip to content

Commit

Permalink
Fixup logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
esamattis committed Jun 20, 2011
1 parent e6ba5f3 commit 0d3a5a9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
6 changes: 2 additions & 4 deletions lib/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ findit = require "findit"
iniparser = require "iniparser"


port = 8080
port = 5678

class Watcher extends EventEmitter

Expand Down Expand Up @@ -78,9 +78,9 @@ class Watcher extends EventEmitter
details http://localhost:#{ port }/##{ id }"""
@exitstatus = err.code
else
console.log "\nRan", @name, "successfully!\n", (new Date) + 2*60*60
@exitstatus = 0

console.log @name, "Emitting", @exitstatus
@emit "end", @exitstatus


Expand All @@ -89,8 +89,6 @@ class Watcher extends EventEmitter
console.log "Rerunning '#{ @name }'"
@rerun = false
@runCMD()
else
console.log "\nRan", @name, "successfully!", (new Date) + 2*60*60


cmd.stdout.on "data", (data) =>
Expand Down
12 changes: 8 additions & 4 deletions lib/web/clientscripts/main.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ class WatcherRemote extends JQEvenEmitter
@update options

remote = now[@name] = {}
remote.sendStdout = (data) =>

remote.sendStdout = (data) =>
@stdout += data
@emit "update"
remote.sendStderr = (data) =>
remote.sendStderr = (data) =>
@stderr += data
@emit "update"
remote.sendStdboth = (data) =>
remote.sendStdboth = (data) =>
@stdboth += data
@emit "update"

Expand All @@ -40,6 +41,8 @@ class WatcherRemote extends JQEvenEmitter
@emit "update"

remote.sendExitStatus = (exitstatus) =>
# Emits update
console.log "Got exitstatus from server", exitstatus
@setStatus exitstatus


Expand Down Expand Up @@ -151,7 +154,8 @@ class Notifies

manager = new WatcherManager

now.init = (watchers) ->

now.init = (watchers, cb) ->
$ ->
for w in watchers
manager.createWatcher w
Expand Down
1 change: 0 additions & 1 deletion lib/web/server.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ exports.registerWatcher = (watcher) ->
watchers[watcher.name] = watcher

watcher.on "stdout", (data) ->
console.log "SENDING", watcher.name
everyone.now[watcher.name]?.sendStdout(data)
watcher.on "stderr", (data) ->
everyone.now[watcher.name]?.sendStderr(data)
Expand Down

0 comments on commit 0d3a5a9

Please sign in to comment.