Runs right before a command is about to return.
774457
def postcmd(self, stop, line):
        """"""
        if self.gold != self.initial_gold:
            self.poutput('Now we gots {0} doubloons'.format(self.gold))
        if self.gold < 0:
            self.poutput("Off to debtorrr's prison.")
            stop = True
        return stop
1155226
def runcmd(command, command_input=None, cwd=None):
    """"""
    proc = subprocess.Popen(command, stdin=subprocess.PIPE,
                            stdout=subprocess.PIPE,
                            stderr=subprocess.PIPE,
                            cwd=cwd)
    (stdout, stderr) = proc.communicate(command_input)
    if proc.returncode != 0:
        sys.stderr.write('ABORTING: command "%s" failed w/ code %s:\n'
                         '%s\n%s' % (command, proc.returncode,
                                     stdout, stderr))
        sys.exit(proc.returncode)
    return proc.returncode, stdout, stderr
277656
public void beforeDeploy(@Observes(precedence = CitrusExtensionConstants.INSTANCE_PRECEDENCE) BeforeDeploy event) {
        try {
            if (!event.getDeployment().testable()) {
                log.info("Producing Citrus framework instance");
                citrusInstance.set(Citrus.newInstance(configurationInstance.get().getConfigurationClass()));
            }
        } catch (Exception e) {
            log.error(CitrusExtensionConstants.CITRUS_EXTENSION_ERROR, e);
            throw e;
        }
    }
95428
def run(command):
    '''
    
    '''
    if isinstance(command, list):
        command = ' '.join(command)
    out = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    return (out.returncode, _prepare(out.stdout), _prepare(out.stderr))
1174548
async def _wait_execute(self, address, command, args, kw):
        """"""
        conn = await self.acquire(command, args)
        try:
            return (await conn.execute(command, *args, **kw))
        finally:
            self.release(conn)
1366074
function injectBefore(replServer, method, beforeFn) {
  var _orig = replServer[method];
  replServer[method] = function() {
    var args = Array.prototype.slice.call(arguments);
    var callback = args.pop();
    beforeFn.apply(null, args.concat(function(err, res) {
      if (err || res) {
        callback(err, res);
      } else {
        _orig.apply(replServer, args.concat(callback));
      }
    }));
  };
  return replServer;
}
921716
function (callback) {
            callback = backpack.ensure(callback, this);

            if (!this.paused) { return callback && callback(new Error('run: not paused')); }

            // set flag that it is no longer paused and fire the stored callback for the command when it was paused
            this.paused = false;
            setTimeout(function () {
                this.__resume();
                delete this.__resume;
                this.triggers.resume(null, this.state.cursor.current());
            }.bind(this), 0);

            callback && callback();
        }
788871
private int doBeforeRun(Map<String, Command> references) throws Exception
	{
		if (status == Command.INITIALIZED)
		{
			for (int i = 0; i < commands.size(); ++i)
			{
				Command cmd = commands.elementAt(i);

				// XXX is this correct?
				if (cmd.isExecutable())
				{
					arguments.add(cmd);
				}
				else
				{
					operations.add(cmd);
				}
			}
			return Command.CHILDREN_FILTERED;
		}
		return status;
	}
1256279
def run(self, command, env={}, path=None,
            uid=None, gid=None, usePTY=0, childFDs=None):
        
        deferred = defer.Deferred()
        processProtocol = _SummaryProcessProtocol(deferred)
        d = defer.maybeDeferred(self.execute, processProtocol, command, env,
                                path, uid, gid, usePTY, childFDs)
        d.addErrback(deferred.errback)
        return deferred
1159163
public final void start(final Command command, final Callback callback) {
        this.start = System.currentTimeMillis();
        this.conditionSatisfied = false;
        command.execute();
        new Async().whilst(new KeepGoing(), new Finish(callback), checker(), 500);
    }
1299921
function later (info) {
	process.stdin.resume();
	const action = start.bind(null, info);
	process.on('SIGINT', action);
	process.on('SIGTERM', action);

	(function wait () {
		if (beenthere) {
			return;
		}

		setTimeout(wait, EVENT_LOOP);
	}());
}
488323
def before(self, context):
        ""
        run.before_each.execute(context)
        self._invoke(self._before, context)
27598
function run(command) {
  const script = findScript(command);
  const config = findConfig();

  if (!script) {
    console.error(`ERROR: File not found: scripts/${command}.js`);
    process.exit(1);
  }

  const start = new Date();
  console.log(`Starting '${chalk.bold.gray(command)}'...`);

  return Promise.resolve().then(() => require(script)(config)).then(() => {
    console.log(
      `Finished '${chalk.bold.gray(command)}' after ` +
      `${chalk.bold(new Date().getTime() - start.getTime())}ms`
    );
  }, err => console.error(err.stack));
}
1163024
def run_before_script(script_file, cwd=None):
    """"""
    try:
        proc = subprocess.Popen(
            shlex.split(str(script_file)),
            stderr=subprocess.PIPE,
            stdout=subprocess.PIPE,
            cwd=cwd,
        )
        for line in iter(proc.stdout.readline, b''):
            sys.stdout.write(console_to_str(line))
        proc.wait()

        if proc.returncode:
            stderr = proc.stderr.read()
            proc.stderr.close()
            stderr = console_to_str(stderr).split('\n')
            stderr = '\n'.join(list(filter(None, stderr)))  # filter empty

            raise exc.BeforeLoadScriptError(
                proc.returncode, os.path.abspath(script_file), stderr
            )

        return proc.returncode
    except OSError as e:
        if e.errno == 2:
            raise exc.BeforeLoadScriptNotExists(e, os.path.abspath(script_file))
        else:
            raise e
995979
protected function beforeCreate()
    {
        $this->dispatcher->getEventsManager()->fire(Events::BEFORE_CREATE, $this);
        $this->beforeSave();
    }
712223
public function beforeHook() : void
    {
        $commentChar = $this->repository->getConfigOperator()->getSafely('core.commentchar', '#');
        $commitMsg   = Git\CommitMessage::createFromFile($this->arguments->get('file', ''), $commentChar);

        $this->repository->setCommitMsg($commitMsg);

        parent::beforeHook();
    }
68261
def listen_until_return(self, *temporary_handlers, timeout=0):
        """"""
        start = time.time()
        while timeout == 0 or time.time() - start < timeout:
            res = self.listen(*temporary_handlers)
            if res is not None:
                return res