Skip to content

Commit a354e47

Browse files
authored
Improve handling of CTRL+C when dnx is used on Windows (#49633)
2 parents 1a8e397 + 5938094 commit a354e47

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

src/Layout/redist/dnx.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# dnx.ps1
2+
# PowerShell script to launch dotnet.exe with 'dnx' and all passed arguments
3+
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
4+
$dotnet = Join-Path $scriptDir 'dotnet.exe'
5+
& $dotnet dnx @Args
6+
exit $LASTEXITCODE

src/Layout/redist/targets/GenerateInstallerLayout.targets

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,13 @@
6464
Overwrite="true" />
6565
</Target>
6666

67-
<Target Name="LayoutDnxScript">
68-
<PropertyGroup>
69-
<DnxScriptSource Condition="$([MSBuild]::IsOSPlatform('WINDOWS'))">dnx.cmd</DnxScriptSource>
70-
<DnxScriptSource Condition="!$([MSBuild]::IsOSPlatform('WINDOWS'))">dnx</DnxScriptSource>
71-
</PropertyGroup>
72-
<Copy SourceFiles="$(DnxScriptSource)" DestinationFolder="$(RedistInstallerLayoutPath)" />
67+
<Target Name="LayoutDnxShim">
68+
<ItemGroup>
69+
<DnxShimSource Condition="$([MSBuild]::IsOSPlatform('Windows'))" Include="dnx.cmd" />
70+
<DnxShimSource Condition="$([MSBuild]::IsOSPlatform('Windows'))" Include="dnx.ps1" />
71+
<DnxShimSource Condition="!$([MSBuild]::IsOSPlatform('WINDOWS'))" Include="dnx" />
72+
</ItemGroup>
73+
<Copy SourceFiles="@(DnxShimSource)" DestinationFolder="$(RedistInstallerLayoutPath)" />
7374

7475
<!-- Mark script as executable -->
7576
<Exec Command="chmod 755 &quot;$(RedistInstallerLayoutPath)/dnx&quot;" Condition="!$([MSBuild]::IsOSPlatform('Windows'))" />
@@ -92,7 +93,7 @@
9293
LayoutManifests;
9394
LayoutBaselineWorkloadSet;
9495
LayoutWorkloadUserLocalMarker;
95-
LayoutDnxScript;
96+
LayoutDnxShim;
9697
CrossgenLayout;
9798
ReplaceBundledRuntimePackFilesWithSymbolicLinks"
9899
AfterTargets="AfterBuild" />
@@ -115,7 +116,7 @@
115116
SkipUnchangedFiles="true" />
116117

117118
<!-- Copy dnx script to root dotnet folder (which will map to DOTNETHOME) -->
118-
<Copy SourceFiles="dnx.cmd" DestinationFolder="$(IntermediateSdkInstallerOutputPath)" />
119+
<Copy SourceFiles="@(DnxShimSource)" DestinationFolder="$(IntermediateSdkInstallerOutputPath)" />
119120

120121
</Target>
121122

0 commit comments

Comments
 (0)