runs the app
@return {Promise}        Resolves when run succeeds otherwise rejects
966324
function runApp (appDir, appName) {
    var binPath = path.join(appDir, 'Contents', 'MacOS', appName);
    events.emit('log', 'Starting: ' + binPath);
    return spawn(binPath);
}
306154
function (callback) {
        return new Promise((resolve, reject) => {
          this.end(result => {
            try {
              resolve(callback(result))
            } catch (err) {
              reject(err)
            }
          })
        })
      }
138439
function() {
        return new Promise(function(resolve, reject) {
            exec("find . ! -name '" + __filename.split('/').pop() + "' -iname '*\.js' | xargs grep 'CRUD.Entity.call(this);' -isl", {
                timeout: 3000,
                cwd: process.cwd()
            }, function(err, stdout, stdin) {
                var results = stdout.trim().split('\n');
                for (var i = 0; i < results.length; i++) {
                    eval(fs.readFileSync(results[i]) + '');
                }
                resolve(Object.keys(CRUD.entities));
            });
        });
    }
11068
function runTask(taskName, directories, options, argv) {
	return new Promise((resolve, reject) => {
		const modulePath = tryResolve(
			tryFile(directories, `${taskName}/index.js`),
			`mrm-task-${taskName}`,
			taskName
		);

		if (!modulePath) {
			reject(new MrmUnknownTask(`Task “${taskName}” not found.`, { taskName }));
			return;
		}

		console.log(kleur.cyan(`Running ${taskName}...`));

		const module = require(modulePath);
		Promise.resolve(module(getConfigGetter(options), argv))
			.then(() => {
				resolve();
			})
			.catch(reject);
	});
}
597429
async function run () {
  if (options.help || Object.keys(options).length === 1) {
    showHelp()
    return
  }
  if (!options.name) {
    console.error('You need to input -n, --name argv')
    return
  }
  if (!options.title) {
    options.title = options.name.split('-').join(' ')
  }

  let content = (await fs.readFile(`${__dirname}/example.tpl`)).toString()
  content = content.replace(/@title@/, options.title || '')
    .replace(/@desc@/, options.desc || '')

  await fs.writeFile(`${__dirname}/../docs/examples/${options.name}.html`, content)
  console.info(`${options.name}.html`)

  let list = (await fs.readFile(`${__dirname}/../docs/_includes/example-list.md`)).toString()
  list += `<li><a href="../examples#${options.name}.html">${options.title}</a></li>\n`
  await fs.writeFile(`${__dirname}/../docs/_includes/example-list.md`, list)
}
365564
def run!(**options)
      interaction = run(options)
      raise error_class.new(interaction.error) unless interaction.success?
      interaction.result
    end
1166137
function runCommand(command, fail, log) {
  return new Promise(function(resolve, reject) {
      if (!command) {
        return resolve('No command found');
      }

      log(command);

      var task = exec(command, {
        cwd: process.cwd()
      }, function(err, stdout, stderr) {
        log(stdout);

        if (err) {
          log(stderr, { color: 'red' });
        }
      });

      task.on('exit', function(code) {
        if (code !== 0 && fail) {
          reject(code);
        }

        resolve(command);
        process.stdin.end();
      });

      process.stdin.pipe(task.stdin, { end: false });
    });
}
1112878
function future (run) {

  var result,
      resolve_listeners = [],
      reject_listeners = [],
      is_resolving = false,
      is_fullfilled = false,
      is_rejected = false,
      is_uncaught = true

  var promise = {
    then: function (onFulfilled, onRejected) {

      if( onRejected instanceof Function ) is_uncaught = false

      if( is_fullfilled && typeof onFulfilled !== 'function' ) return resolvedFuture(result)

      if( is_rejected && typeof onRejected !== 'function' ) return rejectedFuture(result)

      var _promise = future(function (_resolve, _reject) {

        var _onFulfilled = onFulfilled instanceof Function ? function (_result) {

            // nextTick( _resolveThen(_promise, onFulfilled, _result, _resolve, _reject) );

            nextTick(function () {
              try {
                _resolvePromise(_promise, onFulfilled(_result), _resolve, _reject )
              } catch(_reason) {
                _reject(_reason)
              }

              // _resolvePromise(_promise, { then: function (_complete) {
              //   if( is_completed ) return;
              //   is_completed = true;
              //   // var value = onFulfilled(_result);
              //   // if( value === promise ) console.log('TypeError promise'); // eslint-disable-line
              //   // if( value === _promise ) console.log('TypeError _promise'); // eslint-disable-line
              //   _complete( onFulfilled(_result) );
              // } }, _resolve, _reject );
            })

          } : _resolve

        var _onRejected = onRejected instanceof Function ? function (_result) {

            // nextTick( _resolveThen(_promise, onRejected, _result, _resolve, _reject) );

            nextTick(function () {
              try {
                _resolvePromise(_promise, onRejected(_result), _resolve, _reject )
              } catch(_reason) {
                _reject(_reason)
              }
              // _resolvePromise(_promise, { then: function (_complete) {
              //   if( is_completed ) return;
              //   is_completed = true;
              //   _complete( onRejected(_result) );
              // } }, _resolve, _reject );
            })

          } : _reject

        if( is_fullfilled ) _onFulfilled(result)
        else if( is_rejected ) _onRejected(result)
        else {
          resolve_listeners.push(_onFulfilled)
          reject_listeners.push(_onRejected)
        }

      })

      return _promise
    },
    catch: function (onReject) {
      return promise.then(null, onReject)
    },
  }

  var resolve = function (value) {
    if( is_resolving ) return

    is_resolving = true
    _resolvePromise(promise, value, function (_result) {

      is_fullfilled = true
      result = _result

      nextTick( _runQueue( resolve_listeners, result ) )
      reject_listeners.splice()
    }, reject)
  }

  var reject = function (reason) {
    if( is_resolving || is_fullfilled || is_rejected ) return

    is_resolving = true
    is_rejected = true
    result = reason

    nextTick( _runQueue( reject_listeners, result, is_uncaught ) )
    resolve_listeners.splice()
  }

  try{
    // run.call(promise, resolve, reject);
    run(resolve, reject)
  } catch(_reason) {
    reject(_reason)
  }

  return promise

}
274042
def run(self):
        
        self.call_plugins("on_run")
        if vars(self.arguments).get("version", None):
            self.logger.info("{app_name}: {version}".format(app_name=self.app_name, version=self.version))
        else:
            if self.arguments.command == "main":
                self.main()
            else:
                self.subcommands[self.arguments.command].run()
        self.call_plugins("on_end")
1337380
function run(argv, done) {
  if (!argv) {
    argv = parser.argv;
  }

  if (argv.h) {
    parser.showHelp();
    return done(null);
  }

  if (!argv._.length) {
    return done(new Error('Requires an input argument'));
  } else if (argv._.length > 2) {
    return done(new Error('Too many arguments given!'));
  }

  var input = argv._[0];
  if (input.indexOf('http://') === 0 || input.indexOf('https://') === 0) {
    request(input, function (err, res, body) {
      if (err) {
        return done(err);
      }
      convert(body, done);
    });
  } else {
    if (!fs.existsSync(input)) {
      return done(new Error('`' + input + '` does not exist!'));
    }

    fs.readFile(input, 'utf-8', function (err, content) {
      if (err) {
        return done(err);
      }

      convert(content, done);
    });
  }
}
208653
public function run() {
		// Setup our default error route responders
		$this->setup_error_routes();

		// To always be RESTful, create a last-hit route responder to respond in our designated format ALWAYS
		Router::route( function( $request, $response, $service, $matches ) {
			// ALWAYS respond with our formatting function
			Router::app()->api_respond();
		});

		// Finally, call "dispatch" to have our App's Router route the request appropriately
		Router::dispatch(
			substr(
				$_SERVER['REQUEST_URI'],
				strlen( rtrim( $this->config['app-meta']['base_url'], '/' ) ) // Remove a potential trailing slash
			)
		);
	}
867314
function run(options) {
  let files, filePromises = [];
  files = options.args || [];

  for (let i = 0; i < files.length; i++) {
    let file = files[i];
    let filePath = path.resolve(cwd, file);

    if (!fs.existsSync(filePath)) {
      continue;
    }

    let stat = fs.statSync(filePath);
    let ext = path.extname(filePath);

    let isConvert = !options.revert && ext === '.ics'
    let isRevert = options.revert && ext === '.json'

    if (!stat.isFile() || (!isConvert && !isRevert)) {
      continue;
    }

    filePromises.push(Q.nfcall(fs.readFile, filePath)
    .then((buffer) => {
      let output;
      let data = buffer.toString();

      if (isConvert) {
        output = convert(data);
        output = JSON.stringify(output, null, "  ");
      } else if (isRevert) {
        output = revert(data);
      }

      let basename = path.basename(filePath, ext);
      let dirname = path.dirname(filePath);
      let compiledExt = isConvert ? '.json' : '.ics';
      let writePath = path.join(dirname, basename) + compiledExt;

      return Q.nfcall(fs.writeFile, writePath, output);
    })
    .fail((error) => {
      throw new Error(error);
    }));
  }

  return Q.all(filePromises);
}
175022
function run(pool, idx, executionFunction) {
  var p = Promise.resolve()
    .then(executionFunction)
    .then(function() {
      delete pool.promises[idx];
      var next = pool.queue.pop();
      if (next) {
        pool.execute(next);
      }
    });
  pool.promises[idx] = p;
  return p;
}
550656
function doRun() {
    if (Module['calledRun']) return; // run may have just been called while the async setStatus time below was happening
    Module['calledRun'] = true;

    if (ABORT) return;

    ensureInitRuntime();

    preMain();


    if (Module['onRuntimeInitialized']) Module['onRuntimeInitialized']();

    if (Module['_main'] && shouldRunNow) Module['callMain'](args);

    postRun();
  }
1052743
function run (config, done) {
  config = config || {}

  logger.setupFromConfig(config)

  done = helper.isFunction(done) ? done : process.exit
  config = cfg.parseConfig(config.configFile, config)

  let exitCode = 1
  const options = {
    hostname: config.hostname,
    path: config.urlRoot + 'run',
    port: config.port,
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    }
  }

  const request = http.request(options, function (response) {
    response.on('data', function (buffer) {
      const parsedResult = parseExitCode(buffer, exitCode, config.failOnEmptyTestSuite)
      exitCode = parsedResult.exitCode
      process.stdout.write(parsedResult.buffer)
    })

    response.on('end', () => done(exitCode))
  })

  request.on('error', function (e) {
    if (e.code === 'ECONNREFUSED') {
      log.error('There is no server listening on port %d', options.port)
      done(1, e.code)
    } else {
      throw e
    }
  })

  request.end(JSON.stringify({
    args: config.clientArgs,
    removedFiles: config.removedFiles,
    changedFiles: config.changedFiles,
    addedFiles: config.addedFiles,
    refresh: config.refresh,
    colors: config.colors
  }))
}
370178
function execute(cmd) {
  return new Promise((resolve, reject) => {
    exec(cmd, function(err, stdout) {
      if (err) {
        reject(err);
      } else {
        resolve(stdout);
      }
    });
  });
}
326633
async function run() {
  console.log(`\u{1f52c}  Searching for modules inside "${chalk.dim(SRC_DIR)}".`);
  const files = glob.sync('!(index)*.js', { cwd: SRC_DIR });
  const typings = files.map(file => createIconTyping(file));
  await Promise.all([...typings, createIndexTyping(files)]);
  console.log(`\u{1F5C4}  Written typings to ${chalk.dim(TARGET_DIR)}.`);
}