Skip to content
This repository has been archived by the owner on Sep 27, 2020. It is now read-only.

Commit

Permalink
replaced log prefixing with a start and done line
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelkilian committed Mar 23, 2016
1 parent a00c5ef commit 4581edd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/models/projects/list.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ model.updateProject = (project, callback) ->
return callback? new Error error

ks.setChildProperty 'locks', 'projects:' + project.id, true
ks.log logName, utilModel.shellToHtml "Start pulling...\n", 'git pull'
utilModel.runCmd "git pull", {cwd: project.path}, logName, 'git pull', (err, result) ->
ks.setChildProperty 'locks', 'projects:' + project.id, false
return callback err if err
Expand Down
7 changes: 4 additions & 3 deletions src/models/util/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,12 @@ model.runCmd = (cmd, config, logName, logAction, callback) ->
shFlag = '/d /s /c'
config.windowsVerbatimArguments = true

ks.log logName, model.shellToHtml '\x1B[1m' + new Date().toLocaleTimeString() + " - [#{logAction}] > start\n" if logName

proc = spawn sh, [shFlag, cmd], config
proc.on 'error', (err) -> callback? err
proc.on 'close', (code) ->
ks.log logName, model.shellToHtml '\x1B[1m' + new Date().toLocaleTimeString() + " - [#{logAction}] > done\n" if logName
return callback? new Error(stdErr || "Command failed"), stdOut if code != 0
callback? null, stdOut
proc.stdout.on 'data', (chunk) ->
Expand All @@ -143,9 +146,7 @@ model.runCmd = (cmd, config, logName, logAction, callback) ->
stdErr += chunk.toString()

model.shellToHtml = (value, action) ->
prefix = new Date().toLocaleTimeString() + " - [#{action}] > "

return convert.toHtml(prefix + value.replace(/\n/ig, "<br>"));
return convert.toHtml(value.replace(/\n/ig, "<br>"));

model.syncCerts = (path, files, callback) ->
return callback new Error 'Invalid path given' if ! path
Expand Down

0 comments on commit 4581edd

Please sign in to comment.