public function start()
 {
     if (GlobalState::$TYPE == 'LOCAL') {
         $this->register();
         $this->doInstructions($instruction = null);
         $this->tryStopDebugIdUpdater();
         $cmd = 'php -d xdebug.remote_autostart=0 ..' . DS . 'core' . DS . 'DebugIdUpdater.php ' . Config::$DEBUG_ID;
         // start background script for updating in redis expire of debugId
         if (Config::$CORE['os_type'] != "WIN") {
             Config::$DEBUG_PID = exec($cmd . ' > /dev/null 2>&1 & echo $!');
         } else {
             $descriptorspec = [0 => ["pipe", "r"], 1 => ["pipe", "w"]];
             $pipes = '';
             $proc = proc_open("start /B " . $cmd, $descriptorspec, $pipes);
             $info = proc_get_status($proc);
             Config::$DEBUG_PID = $info['pid'];
             //proc_close( $proc );
         }
         // put pid into file for try kill DebugIdUpdater.php it before next run CodeRunner
         file_put_contents(".run", Config::$DEBUG_PID);
         for (;;) {
             $this->message_processor->run();
             $this->responder_processor->localRun();
             stream_set_blocking(STDIN, false);
             $command = trim(fgets(STDIN));
             stream_set_blocking(STDIN, true);
             if ($command == 'terminate') {
                 $this->terminateRunner($signal = 'SIGINT');
             }
         }
     } else {
         $this->message_processor->run();
         $this->responder_processor->cloudRun();
     }
 }
 public function start()
 {
     if (GlobalState::$TYPE == 'LOCAL') {
         $this->register();
         $this->doInstructions($instruction = null);
         $this->tryStopDebugIdUpdater();
         // CODE FOR TESTING
         //$predis = RedisManager::getInstance()->getRedis();
         //$predis->set( "51591778-2B61-B82F-FF33-B7B5F460FD00:8C902CEE-643E-C017-FF7D-C05ACC97C600:CodeRunnerDebug-TEST-DIMA" ,"51591778-2B61-B82F-FF33-B7B5F460FD00:8C902CEE-643E-C017-FF7D-C05ACC97C600:CodeRunnerDebug-TEST-DIMA" );
         //$predis->expire( "51591778-2B61-B82F-FF33-B7B5F460FD00:8C902CEE-643E-C017-FF7D-C05ACC97C600:CodeRunnerDebug-TEST-DIMA", 25 );
         $cmd = 'php ..' . DS . 'core' . DS . 'DebugIdUpdater.php ' . Config::$DEBUG_ID;
         // start background script for updating in redis expire of debugId
         if (Config::$CORE['os_type'] != "WIN") {
             Config::$DEBUG_PID = exec($cmd . ' > /dev/null 2>&1 & echo $!');
         } else {
             $descriptorspec = [0 => ["pipe", "r"], 1 => ["pipe", "w"]];
             $pipes = '';
             $proc = proc_open("start /B " . $cmd, $descriptorspec, $pipes);
             $info = proc_get_status($proc);
             Config::$DEBUG_PID = $info['pid'];
             //proc_close( $proc );
         }
         // put pid into file for try kill DebugIdUpdater.php it before next run CodeRunner
         file_put_contents(".run", Config::$DEBUG_PID);
         for (;;) {
             $this->message_processor->run();
             $this->responder_processor->localRun();
             stream_set_blocking(STDIN, false);
             $command = trim(fgets(STDIN));
             stream_set_blocking(STDIN, true);
             if ($command == 'terminate') {
                 $this->terminateRunner($signal = 'SIGINT');
             }
         }
     } else {
         $this->message_processor->run();
         $this->responder_processor->cloudRun();
     }
 }