Browse files

extended stderr to server as well.

  • Loading branch information...
1 parent 3b6227d commit 0cc152eecaf29f6ef822c1bf315563dd1c724fbf @ltackett committed Mar 28, 2012
Showing with 13 additions and 3 deletions.
  1. +1 −0 app/client/app.coffee
  2. +12 −3 app/server/app.coffee
View
1 app/client/app.coffee
@@ -324,6 +324,7 @@ exports.init = ->
## ==========================================================================
SS.events.on "stdout", (text) -> stdout(text)
+ SS.events.on "stderr", (obj) -> stderr(obj.text, obj.prefix)
SS.events.on 'changeDirectory', (dir) -> changeDirectory(dir)
SS.events.on "previousDirectory", (dir) -> previousDirectory()
SS.events.on "commandHelp", (cmd) -> commandHelp(cmd)
View
15 app/server/app.coffee
@@ -12,9 +12,15 @@ stdout= (text) ->
SS.server.app.hideSpinner()
return ""
+stderr= (text, prefix) ->
+ obj = {text: text, prefix: prefix}
+ SS.server.app.stderr(obj)
+ SS.server.app.hideSpinner()
+ return ""
+
error=
requiredParameters: (command, params, reqParams) ->
- stdout "#{formatError()} #{formatCommand(command)} requires #{reqParams} parameters, you provided #{params.length}"
+ stderr "#{formatCommand(command)} requires #{reqParams} parameters, you provided #{params.length}"
play_audio= (obj) ->
SS.server.app.play_audio(obj)
@@ -36,7 +42,7 @@ programs=
stdout " "
if error
- stdout formatError(error)
+ stderr error
else
error.requiredParameters(command, params, reqParams)
@@ -97,6 +103,9 @@ exports.actions =
stdout: (text, cb) ->
SS.publish.socket(@session.attributes.sessID, 'stdout', text)
+ stderr: (obj, cb) ->
+ SS.publish.socket(@session.attributes.sessID, 'stderr', obj)
+
play_audio: (obj, cb) ->
SS.publish.socket(@session.attributes.sessID, 'play_audio', obj)
@@ -107,4 +116,4 @@ exports.actions =
if typeof programs[command] == "function"
programs[command](cmd, command, params)
else
- stdout "#{formatError()} #{formatCommand(command)} was issued to the server, but no application exists on the server which matched the request."
+ stderr "#{formatCommand(command)} was issued to the server, but no application exists on the server which matched the request."

0 comments on commit 0cc152e

Please sign in to comment.