Handle walkdir error events

This commit is contained in:
Kevin Sawicki
2013-10-28 13:44:37 -07:00
parent 1368b60f16
commit cdd4c9669a

View File

@@ -4,7 +4,7 @@ walkdir = require 'walkdir'
module.exports = (grunt) ->
cp: (source, destination, {filter}={}) ->
walkdir.sync source, (sourcePath, stats) ->
walker = walkdir.sync source, (sourcePath, stats) ->
return if filter?.test(sourcePath)
destinationPath = path.join(destination, path.relative(source, sourcePath))
@@ -16,6 +16,7 @@ module.exports = (grunt) ->
if grunt.file.exists(destinationPath)
fs.chmodSync(destinationPath, fs.statSync(sourcePath).mode)
walker.on 'error', (error) -> grunt.fatal(error)
grunt.log.writeln("Copied #{source.cyan} to #{destination.cyan}.")