mirror of
https://github.com/microsoft/WSL.git
synced 2025-12-11 04:35:57 -06:00
Relaunch the debug shell after it exits. (#13379)
Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
This commit is contained in:
parent
6121b56152
commit
fd3b858064
@ -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);
|
execl("/usr/bin/setsid", "/usr/bin/setsid", "/sbin/agetty", "-w", "-L", LX_INIT_HVC_DEBUG_SHELL, "-a", "root", NULL);
|
||||||
LOG_ERROR("execl failed, {}", errno);
|
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)
|
int StartDhcpClient(int DhcpTimeout)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user