Răsfoiți Sursa

Add in some debugging logging

James Allen 12 ani în urmă
părinte
comite
42af7c4e63

+ 7 - 1
services/clsi/app/coffee/OutputFileFinder.coffee

@@ -2,12 +2,15 @@ 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) ->) ->
 		incomingResources = {}
 		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?
@@ -33,8 +36,11 @@ module.exports = OutputFileFinder =
 		callback = (error, fileList) ->
 			_callback(error, fileList)
 			_callback = () ->
+				
+		args = [directory, "-type", "f"]
+		logger.log args: args, "running find command"
 
-		proc = spawn("find", [directory, "-type", "f"])
+		proc = spawn("find", args)
 		stdout = ""
 		proc.stdout.on "data", (chunk) ->
 			stdout += chunk.toString()	

+ 1 - 0
services/clsi/test/unit/coffee/OutputFileFinderTests.coffee

@@ -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()