public static function runImmediateTask($taskId)
    {
        $command = new ProcessBuilder();
        $command->setWorkingDirectory(Yii::getAlias('@app'));
        $command->setPrefix(self::getPhpBinary());
        if (strncasecmp(PHP_OS, 'WIN', 3) === 0) {
            $command->add('yii');
        } else {
            $command->add('./yii');
        }
        $command->add('deferred/index')->add("$taskId");
        $process = $command->getProcess();
        $process->setWorkingDirectory(Yii::getAlias('@app'));
        $process->disableOutput();
        if (strncasecmp(PHP_OS, 'WIN', 3) === 0) {
            $process->setCommandLine('start /b "deferred" ' . $process->getCommandLine());
        } else {
            $process->setCommandLine($process->getCommandLine() . ' &');
        }
        if (isset(Yii::$app->params['deferred.env'])) {
            $process->setEnv(ArrayHelper::merge(Yii::$app->params['deferred.env'], $process->getEnv()));
        }
        $process->mustRun();
    }
public static function runImmediateTask($taskId)
    {
        $command = new ProcessBuilder();
        $command->setWorkingDirectory(Yii::getAlias('@app'));
        $command->setPrefix(self::getPhpBinary());
        if (strncasecmp(PHP_OS, 'WIN', 3) === 0) {
            $command->add('yii');
        } else {
            $command->add('./yii');
        }
        $command->add('deferred/index')->add("$taskId");
        $process = $command->getProcess();
        $process->setWorkingDirectory(Yii::getAlias('@app'));
        $process->disableOutput();
        if (strncasecmp(PHP_OS, 'WIN', 3) === 0) {
            $process->setCommandLine('start /b "deferred" ' . $process->getCommandLine());
        } else {
            $process->setCommandLine($process->getCommandLine() . ' &');
        }
        if (isset(Yii::$app->params['deferred.env'])) {
            $process->setEnv(ArrayHelper::merge(Yii::$app->params['deferred.env'], $process->getEnv()));
        }
        $process->mustRun();
    }
public static function runImmediateTask ( $ taskId ) { $ command = new ProcessBuilder ( ) ; $ command -> setWorkingDirectory ( Yii :: getAlias ( '@app' ) ) ; $ command -> setPrefix ( self :: getPhpBinary ( ) ) ; if ( strncasecmp ( PHP_OS , 'WIN' , 3 ) === 0 ) { $ command -> add ( 'yii' ) ; } else { $ command -> add ( './yii' ) ; } $ command -> add ( 'deferred/index' ) -> add ( "$taskId" ) ; $ process = $ command -> getProcess ( ) ; $ process -> setWorkingDirectory ( Yii :: getAlias ( '@app' ) ) ; $ process -> disableOutput ( ) ; if ( strncasecmp ( PHP_OS , 'WIN' , 3 ) === 0 ) { $ process -> setCommandLine ( 'start /b "deferred" ' . $ process -> getCommandLine ( ) ) ; } else { $ process -> setCommandLine ( $ process -> getCommandLine ( ) . ' &' ) ; } if ( isset ( Yii :: $ app -> params [ 'deferred.env' ] ) ) { $ process -> setEnv ( ArrayHelper :: merge ( Yii :: $ app -> params [ 'deferred.env' ] , $ process -> getEnv ( ) ) ) ; } $ process -> mustRun ( ) ; }
Performs immediate task start - fire and forget.
Used in web requests to start task in background.

@param integer $taskId

@throws \Exception
Performs immediate task start - fire and forget . Used in web requests to start task in background .