Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
29 | public function handle(): void |
||
30 | { |
||
31 | $tmux = new Tmux; |
||
32 | $tmux_session = Settings::settingValue('tmux_session') ?? 0; |
||
33 | |||
34 | // Set running value to on. |
||
35 | $tmux->startRunning(); |
||
36 | |||
37 | // check if session exists |
||
38 | $session = Process::run("tmux list-session | grep $tmux_session"); |
||
39 | if ($session->exitCode() === 1) { |
||
40 | $this->info('Starting the tmux server and monitor script'); |
||
41 | Process::forever()->tty()->run('php '.app()->/* @scrutinizer ignore-call */ path().'/../misc/update/tmux/run.php')->output(); |
||
42 | } else { |
||
43 | $this->error("tmux session: '".$tmux_session."' is already running, aborting."); |
||
44 | exit(); |
||
|
|||
45 | } |
||
48 |
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.