Esempio n. 1
0
One.prototype._run_async = function(fn, args, callback, is_setter) {
  var is_async;
  var context = {
    async: function() {
      is_async = true;
      return util.once(callback);
    }
  };

  mix(context, this.context);
  var result = fn.apply(context, args);
  if (is_async) {
    return;
  }

  if (is_setter) {
    callback(null, result);

  } else {
    if (typeof result === 'string' || result instanceof Error) {
      return callback(result);
    }

    // `result` tells whether the value is valid
    // if `result` == true, err -> null
    callback(!result || null);
  }
};
Esempio n. 2
0
Spawns.prototype._get_spawn = function(parsed) {
  if (!is_windows) {
    return spawn('sh', ['-c', parsed.origin], this._options);
  }

  var options = mix({
    windowsVerbatimArguments: true
  }, this._options);

  return win_spawn(parsed.name, parsed.args, options);
};