Skip to content

Commit

Permalink
Replace ConhostConnection with ConptyConnection (#3461)
Browse files Browse the repository at this point in the history
This commit deletes ConhostConnection and replaces it with
ConptyConnection. The ConptyConnection uses CreatePseudoConsole and
depends on winconpty to override the one from kernel32.

* winconpty must be packageable, so I've added GetPackagingOutputs.
   * To validate this, I added conpty.dll to the MSIX regression script.
* I moved the code from conpty-universal that deals with environment
  strings into the types library.

This puts us in a way better place to implement #2563, as we can now
separately detect a failure to launch a pseudoconsole, a failure to
CreateProcess, and an unexpected termination of the launched process.

Fixes #1131.
  • Loading branch information
DHowett authored Nov 6, 2019
1 parent d2dcdef commit 357e835
Show file tree
Hide file tree
Showing 17 changed files with 523 additions and 889 deletions.
4 changes: 4 additions & 0 deletions build/scripts/Test-WindowsTerminalPackage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ Try {
Throw "Failed to find cpprest_2_10.dll -- check the WAP packaging project"
}
}

If ($null -eq (Get-Item "$AppxPackageRootPath\conpty.dll" -EA:Ignore)) {
Throw "Failed to find conpty.dll -- check the wapproj and winconpty.vcxproj"
}
} Finally {
Remove-Item -Recurse -Force $AppxPackageRootPath
}
7 changes: 1 addition & 6 deletions src/cascadia/CascadiaPackage/CascadiaPackage.wapproj
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,13 @@
<ProjectReference Include="..\WindowsTerminal\WindowsTerminal.vcxproj" />
<ProjectReference Include="..\..\host\exe\Host.EXE.vcxproj" />
</ItemGroup>
<!-- Stomp the path to conhost.exe.
This task will copy OpenConsole.exe to the appx as conhost.exe, and place it
adjacent to WindowsTerminal.exe.
-->

<Target Name="OpenConsoleStompSourceProjectForWapProject" BeforeTargets="_ConvertItems">
<ItemGroup>
<!-- Stomp all "SourceProject" values for all incoming dependencies to flatten the package. -->
<_TemporaryFilteredWapProjOutput Include="@(_FilteredNonWapProjProjectOutput)" />
<_FilteredNonWapProjProjectOutput Remove="@(_TemporaryFilteredWapProjOutput)" />
<_FilteredNonWapProjProjectOutput Include="@(_TemporaryFilteredWapProjOutput)">
<!-- Override the filename for OpenConsole.exe (only) -->
<TargetPath Condition="'%(Filename)' == 'OpenConsole' and '%(Extension)' == '.exe'">conhost.exe</TargetPath>
<!-- Blank the SourceProject here to vend all files into the root of the package. -->
<SourceProject>
</SourceProject>
Expand Down
12 changes: 6 additions & 6 deletions src/cascadia/TerminalApp/TerminalPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,12 +459,12 @@ namespace winrt::TerminalApp::implementation

else
{
auto conhostConn = TerminalConnection::ConhostConnection(settings.Commandline(),
settings.StartingDirectory(),
settings.StartingTitle(),
settings.InitialRows(),
settings.InitialCols(),
winrt::guid());
auto conhostConn = TerminalConnection::ConptyConnection(settings.Commandline(),
settings.StartingDirectory(),
settings.StartingTitle(),
settings.InitialRows(),
settings.InitialCols(),
winrt::guid());
sessionGuid = conhostConn.Guid();
connection = conhostConn;
}
Expand Down
238 changes: 0 additions & 238 deletions src/cascadia/TerminalConnection/ConhostConnection.cpp

This file was deleted.

58 changes: 0 additions & 58 deletions src/cascadia/TerminalConnection/ConhostConnection.h

This file was deleted.

15 changes: 0 additions & 15 deletions src/cascadia/TerminalConnection/ConhostConnection.idl

This file was deleted.

Loading

0 comments on commit 357e835

Please sign in to comment.