mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Add in some debugging logging
This commit is contained in:
parent
ffa7919e46
commit
42af7c4e63
2 changed files with 8 additions and 1 deletions
|
@ -2,12 +2,15 @@ async = require "async"
|
||||||
fs = require "fs"
|
fs = require "fs"
|
||||||
Path = require "path"
|
Path = require "path"
|
||||||
spawn = require("child_process").spawn
|
spawn = require("child_process").spawn
|
||||||
|
logger = require "logger-sharelatex"
|
||||||
|
|
||||||
module.exports = OutputFileFinder =
|
module.exports = OutputFileFinder =
|
||||||
findOutputFiles: (resources, directory, callback = (error, outputFiles) ->) ->
|
findOutputFiles: (resources, directory, callback = (error, outputFiles) ->) ->
|
||||||
incomingResources = {}
|
incomingResources = {}
|
||||||
for resource in resources
|
for resource in resources
|
||||||
incomingResources[resource.path] = true
|
incomingResources[resource.path] = true
|
||||||
|
|
||||||
|
logger.log directory: directory, "getting output files"
|
||||||
|
|
||||||
OutputFileFinder._getAllFiles directory, (error, allFiles = []) ->
|
OutputFileFinder._getAllFiles directory, (error, allFiles = []) ->
|
||||||
return callback(error) if error?
|
return callback(error) if error?
|
||||||
|
@ -33,8 +36,11 @@ module.exports = OutputFileFinder =
|
||||||
callback = (error, fileList) ->
|
callback = (error, fileList) ->
|
||||||
_callback(error, fileList)
|
_callback(error, fileList)
|
||||||
_callback = () ->
|
_callback = () ->
|
||||||
|
|
||||||
|
args = [directory, "-type", "f"]
|
||||||
|
logger.log args: args, "running find command"
|
||||||
|
|
||||||
proc = spawn("find", [directory, "-type", "f"])
|
proc = spawn("find", args)
|
||||||
stdout = ""
|
stdout = ""
|
||||||
proc.stdout.on "data", (chunk) ->
|
proc.stdout.on "data", (chunk) ->
|
||||||
stdout += chunk.toString()
|
stdout += chunk.toString()
|
||||||
|
|
|
@ -11,6 +11,7 @@ describe "OutputFileFinder", ->
|
||||||
@OutputFileFinder = SandboxedModule.require modulePath, requires:
|
@OutputFileFinder = SandboxedModule.require modulePath, requires:
|
||||||
"fs": @fs = {}
|
"fs": @fs = {}
|
||||||
"child_process": spawn: @spawn = sinon.stub()
|
"child_process": spawn: @spawn = sinon.stub()
|
||||||
|
"logger-sharelatex": { log: sinon.stub() }
|
||||||
@directory = "/test/dir"
|
@directory = "/test/dir"
|
||||||
@callback = sinon.stub()
|
@callback = sinon.stub()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue