Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[dist] task written in coffee

  • Loading branch information...
commit b9b67e2308a6a7b079c75314fa4df81ee5fe4f93 1 parent 021a5f5
@rma4ok authored
Showing with 0 additions and 50 deletions.
  1. +0 −50 tasks/bg-shell.js
View
50 tasks/bg-shell.js
@@ -1,50 +0,0 @@
-// Generated by CoffeeScript 1.4.0
-
-module.exports = function(grunt) {
- 'use strict';
-
- var defaults, exec, log, noop, _;
- exec = require('child_process').exec;
- log = grunt.log;
- _ = grunt.utils._;
- noop = function() {};
- defaults = {
- execOpts: null,
- stdout: true,
- stderr: true,
- bg: false,
- fail: false,
- done: noop
- };
- grunt.registerMultiTask('bgShell', 'Run shell commands', function() {
- var childProcess, data, failOnError, stderr, stderrHandler, stdout, stdoutHandler, taskDone;
- data = _.defaults(this.data, grunt.config.get('bgShell')._defaults, defaults);
- stdout = data.stdout;
- stderr = data.stderr;
- taskDone = !data.bg ? this.async() : noop;
- stdoutHandler = _.isFunction(stdout) ? stdout : stdout ? function(out) {
- log.write(out);
- } : noop;
- failOnError = function(err) {
- if (data.fail) {
- grunt.fatal(err);
- }
- };
- stderrHandler = _.isFunction(stderr) ? function(err) {
- stderr(err);
- failOnError(err);
- } : stderr ? function(err) {
- log.error(err);
- failOnError(err);
- } : failOnError;
- childProcess = exec(data.cmd, data.execOpts, function(err, stdout, stderr) {
- data.done(err, stdout, stderr);
- if (err) {
- stderrHandler(err);
- }
- return taskDone();
- });
- childProcess.stdout.on('data', stdoutHandler);
- childProcess.stderr.on('data', stderrHandler);
- });
-};
Please sign in to comment.
Something went wrong with that request. Please try again.