Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# in gruntfile.coffee
{exec} = require('child_process')
runCommand = (exp, done) ->
exec exp, (error, stdout, stderr) ->
done(true) if error or stderr
done(false,stdout)
grunt.registerMultiTask 'test', 'test command', ->
conf = @
done = conf.async()
{src, dest} = conf.data.file
runCommand 'ls -l', (error, ret) =>
if error
grunt.log.writeln('File "' + dest + '" failed.')
return done(false)
grunt.log.writeln('File "' + ret + '" created.');
done(true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment