mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-28 17:01:16 +00:00
Update tmux-ui:stop command to use --kill option if tmux session needs to be killed
This commit is contained in:
@@ -14,7 +14,7 @@ class TmuxUIStop extends Command
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'tmux-ui:stop {type}';
|
||||
protected $signature = 'tmux-ui:stop {--kill}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
@@ -28,20 +28,16 @@ class TmuxUIStop extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
if ($this->argument('type') !== null) {
|
||||
(new Tmux())->stopIfRunning();
|
||||
|
||||
if ($this->argument('type') === 'true') {
|
||||
$sessionName = Settings::settingValue('site.tmux.tmux_session');
|
||||
$tmuxSession = new Process('tmux kill-session -t '.$sessionName);
|
||||
$this->info('Killing active tmux session: '.$sessionName);
|
||||
$tmuxSession->run();
|
||||
if ($tmuxSession->isSuccessful()) {
|
||||
$this->info('Tmux session killed successfully');
|
||||
}
|
||||
$tmux = new Tmux();
|
||||
$tmux->stopIfRunning();
|
||||
if ($tmux->isRunning() && $this->option('kill') === true) {
|
||||
$sessionName = Settings::settingValue('site.tmux.tmux_session');
|
||||
$tmuxSession = new Process('tmux kill-session -t '.$sessionName);
|
||||
$this->info('Killing active tmux session: '.$sessionName);
|
||||
$tmuxSession->run();
|
||||
if ($tmuxSession->isSuccessful()) {
|
||||
$this->info('Tmux session killed successfully');
|
||||
}
|
||||
} else {
|
||||
$this->error($this->description);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user