diff --git a/src/host/ut_host/VtIoTests.cpp b/src/host/ut_host/VtIoTests.cpp index 703e973eb2..c87256acfe 100644 --- a/src/host/ut_host/VtIoTests.cpp +++ b/src/host/ut_host/VtIoTests.cpp @@ -6,11 +6,11 @@ #include "../../inc/consoletaeftemplates.hpp" #include "../../types/inc/Viewport.hpp" +#include "../VtIo.hpp" +#include "../../interactivity/inc/ServiceLocator.hpp" +#include "../../renderer/base/Renderer.hpp" #include "../../renderer/vt/Xterm256Engine.hpp" #include "../../renderer/vt/XtermEngine.hpp" -#include "../../renderer/base/Renderer.hpp" -#include "../Settings.hpp" -#include "../VtIo.hpp" #if TIL_FEATURE_CONHOSTDXENGINE_ENABLED #include "../../renderer/dx/DxRenderer.hpp" @@ -19,7 +19,7 @@ using namespace WEX::Common; using namespace WEX::Logging; using namespace WEX::TestExecution; -using namespace std; +using namespace Microsoft::Console::Interactivity; class Microsoft::Console::VirtualTerminal::VtIoTests { @@ -473,6 +473,13 @@ void VtIoTests::BasicAnonymousPipeOpeningWithSignalChannelTest() Log::Comment(L"\tinitializing vtio"); + // CreateIoHandlers() assert()s on IsConsoleLocked() to guard against a race condition. + auto& gci = ServiceLocator::LocateGlobals().getConsoleInformation(); + gci.LockConsole(); + const auto cleanup = wil::scope_exit([&]() { + gci.UnlockConsole(); + }); + VtIo vtio; VERIFY_IS_FALSE(vtio.IsUsingVt()); VERIFY_ARE_EQUAL(nullptr, vtio._pPtySignalInputThread);