Relaunch the debug shell after it exits. (#13379)

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
This commit is contained in:
Ben Hillis 2025-08-13 16:31:37 -07:00 committed by GitHub
parent 6121b56152
commit fd3b858064
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1194,10 +1194,28 @@ Return Value:
--*/
{
UtilCreateChildProcess("agetty", []() {
// Spawn a child process to handle relaunching the debug shell if it exits.
UtilCreateChildProcess("DebugShell", []() {
for (;;)
{
const auto Pid = UtilCreateChildProcess("agetty", []() {
execl("/usr/bin/setsid", "/usr/bin/setsid", "/sbin/agetty", "-w", "-L", LX_INIT_HVC_DEBUG_SHELL, "-a", "root", NULL);
LOG_ERROR("execl failed, {}", errno);
});
if (Pid < 0)
{
_exit(1);
}
int Status = -1;
if (TEMP_FAILURE_RETRY(waitpid(Pid, &Status, 0)) < 0)
{
LOG_ERROR("waitpid failed {}", errno);
_exit(1);
}
}
});
}
int StartDhcpClient(int DhcpTimeout)