Esempio n. 1
0
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return int
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $config = (new ConfigLoader())->load();
     // Create the child process
     // All the code after pcntl_fork () will be performed by two processes: parent and child
     if ($config->getItem('config', 'daemon', false)) {
         $child_pid = pcntl_fork();
         if ($child_pid) {
             // Exit from the parent process that is bound to the console
             exit;
         }
         // Make the child as the main process.
         posix_setsid();
     }
     $math = Bitcoin::getMath();
     $params = new Params($math);
     $loop = \React\EventLoop\Factory::create();
     $db = new DebugDb(Db::create($config));
     $node = new BitcoinNode($config, $params, $db);
     $container = new Container();
     $container['debug'] = function (Container $c) use($node) {
         $context = $c['zmq'];
         return new ZmqDebug($node, $context);
     };
     $this->setupServices($container, $node, $loop, $config, $db);
     $loop->run();
     return 0;
 }
Esempio n. 2
0
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return int
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     call_user_func([Db::create((new ConfigLoader())->load()), $this->dbName]);
     return 0;
 }