Files
newznab-tmux/app/Console/Commands/TmuxUIStart.php
T

55 lines
1.2 KiB
PHP

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Symfony\Component\Process\Process;
class TmuxUIStart extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'tmux-ui:start';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Start the processing of tmux scripts. This is functionally equivalent to setting the
\'tmux running\' setting in admin.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
* @throws \Symfony\Component\Process\Exception\LogicException
* @throws \Symfony\Component\Process\Exception\RuntimeException
*/
public function handle()
{
$process = new Process('php misc/update/tmux/start.php');
$process->setTty(true);
$process->run(function ($type, $buffer) {
if (Process::ERR === $type) {
echo 'ERR > '.$buffer;
} else {
echo $buffer;
}
});
}
}