Add in some debugging logging

This commit is contained in:
James Allen 2014-12-09 11:16:16 +00:00
parent ffa7919e46
commit 42af7c4e63
2 changed files with 8 additions and 1 deletions

View file

@ -2,6 +2,7 @@ async = require "async"
fs = require "fs"
Path = require "path"
spawn = require("child_process").spawn
logger = require "logger-sharelatex"
module.exports = OutputFileFinder =
findOutputFiles: (resources, directory, callback = (error, outputFiles) ->) ->
@ -9,6 +10,8 @@ module.exports = OutputFileFinder =
for resource in resources
incomingResources[resource.path] = true
logger.log directory: directory, "getting output files"
OutputFileFinder._getAllFiles directory, (error, allFiles = []) ->
return callback(error) if error?
jobs = []
@ -34,7 +37,10 @@ module.exports = OutputFileFinder =
_callback(error, fileList)
_callback = () ->
proc = spawn("find", [directory, "-type", "f"])
args = [directory, "-type", "f"]
logger.log args: args, "running find command"
proc = spawn("find", args)
stdout = ""
proc.stdout.on "data", (chunk) ->
stdout += chunk.toString()

View file

@ -11,6 +11,7 @@ describe "OutputFileFinder", ->
@OutputFileFinder = SandboxedModule.require modulePath, requires:
"fs": @fs = {}
"child_process": spawn: @spawn = sinon.stub()
"logger-sharelatex": { log: sinon.stub() }
@directory = "/test/dir"
@callback = sinon.stub()