feat(Terminal):对交互式命令进行提示并终止执行

This commit is contained in:
妙码生花 2024-03-11 15:08:16 +08:00
parent 1310d6d106
commit 631fccd9e6

View File

@ -220,6 +220,7 @@ class Terminal
if (preg_match('/\r\n|\r|\n/', $newOutput)) {
$this->output($newOutput);
$this->outputContent = $contents;
$this->checkOutput();
}
}
@ -287,6 +288,17 @@ class Terminal
}
}
/**
* 检查输出
*/
public function checkOutput(): void
{
if (str_contains($this->outputContent, '(Y/n)')) {
$this->execError('An interactive command has been detected, and you can manually execute the command to confirm the situation.', true);
}
}
/**
* 输出状态标记
* @param string $flag