From c7dc3505042f01e991cc793b7b6cb2460514710d Mon Sep 17 00:00:00 2001 From: Don-Vito Date: Mon, 8 Mar 2021 16:56:36 +0200 Subject: [PATCH] Fix TermControl initialization to pre-seed working dir (#9397) ## PR Checklist * [x] Closes https://github.com/microsoft/terminal/issues/8969 * [x] CLA signed. * [ ] Tests added/passed * [ ] Documentation updated. * [ ] Schema updated. * [ ] I've discussed this with core contributors already. ## Detailed Description of the Pull Request / Additional comments ## Validation Steps Performed (cherry picked from commit 19bd0c94e726980136dbcecf53499833e71bc94d) --- src/cascadia/TerminalControl/TermControl.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cascadia/TerminalControl/TermControl.cpp b/src/cascadia/TerminalControl/TermControl.cpp index 041f9393802..a63d29869dc 100644 --- a/src/cascadia/TerminalControl/TermControl.cpp +++ b/src/cascadia/TerminalControl/TermControl.cpp @@ -87,6 +87,9 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation _terminal = std::make_unique<::Microsoft::Terminal::Core::Terminal>(); + // GH#8969: pre-seed working directory to prevent potential races + _terminal->SetWorkingDirectory(_settings.StartingDirectory()); + auto pfnWarningBell = std::bind(&TermControl::_TerminalWarningBell, this); _terminal->SetWarningBellCallback(pfnWarningBell);