mirror of
https://github.com/microsoft/WSL.git
synced 2025-07-02 07:01:12 +00:00
Don't display a warning when the binfmt process doesn't have a controlling terminal (#13176)
Some checks are pending
Build documentation / DeployDocs (push) Waiting to run
Some checks are pending
Build documentation / DeployDocs (push) Waiting to run
This commit is contained in:
parent
902848b76b
commit
c1d6ad1d15
2 changed files with 19 additions and 1 deletions
|
@ -678,12 +678,19 @@ Return Value:
|
|||
|
||||
//
|
||||
// Ensure that stdin represents the foreground process group.
|
||||
// N.B. It's possible that standard file descriptors point to tty while the process
|
||||
// has no controlling terminal (in case its parent called setsid() without opening a new terminal for instance).
|
||||
// See https://github.com/microsoft/WSL/issues/13173.
|
||||
//
|
||||
|
||||
auto processGroup = tcgetpgrp(0);
|
||||
if (processGroup < 0)
|
||||
{
|
||||
LOG_STDERR("tcgetpgrp failed");
|
||||
if (errno != ENOTTY)
|
||||
{
|
||||
LOG_STDERR("tcgetpgrp failed");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -6119,5 +6119,16 @@ Error code: Wsl/InstallDistro/WSL_E_INVALID_JSON\r\n",
|
|||
VERIFY_ARE_EQUAL(err, L"");
|
||||
}
|
||||
|
||||
// Validate that calling the binfmt interpreter with tty fd's but not controlling terminal doesn't display a warning.
|
||||
// See https://github.com/microsoft/WSL/issues/13173.
|
||||
TEST_METHOD(SetSidNoWarning)
|
||||
{
|
||||
auto [out, err] =
|
||||
LxsstuLaunchWslAndCaptureOutput(L"socat - 'EXEC:setsid --wait cmd.exe /c echo OK',pty,setsid,ctty,stderr");
|
||||
|
||||
VERIFY_ARE_EQUAL(out, L"OK\r\r\n");
|
||||
VERIFY_ARE_EQUAL(err, L"");
|
||||
}
|
||||
|
||||
}; // namespace UnitTests
|
||||
} // namespace UnitTests
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue