Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linux crash #126

Merged
merged 2 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions DotNetPlease/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public async Task<int> ExecuteAsync(params string[] args)
{
using var scope = ServiceProvider.CreateScope();
var parser = BuildCommandLineParser();
var cursorVisible = !Console.IsOutputRedirected && Console.CursorVisible;
if (!Console.IsOutputRedirected)
var cursorVisible = !Console.IsOutputRedirected && OperatingSystem.IsWindows() && Console.CursorVisible;
if (!Console.IsOutputRedirected && OperatingSystem.IsWindows())
{
Console.CursorVisible = false;
}
Expand All @@ -84,7 +84,7 @@ public async Task<int> ExecuteAsync(params string[] args)
}
finally
{
if (!Console.IsOutputRedirected)
if (!Console.IsOutputRedirected && OperatingSystem.IsWindows())
{
Console.CursorVisible = cursorVisible;
}
Expand Down
6 changes: 3 additions & 3 deletions DotNetPlease/DotNetPlease.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
<PackageReference Include="MediatR" Version="12.2.0" />
<PackageReference Include="Microsoft.Build" Version="17.10.4" />
<PackageReference Include="Microsoft.Build.Framework" Version="17.10.4" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.10.4" />
<PackageReference Include="Microsoft.Build" Version="17.11.4" />
<PackageReference Include="Microsoft.Build.Framework" Version="17.11.4" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.11.4" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="8.0.0" />
Expand Down
44 changes: 16 additions & 28 deletions DotNetPlease/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,32 @@
},
"Microsoft.Build": {
"type": "Direct",
"requested": "[17.10.4, )",
"resolved": "17.10.4",
"contentHash": "ZmGA8vhVXFzC4oo48ybQKlEybVKd0Ntfdr+Enqrn5ES1R6e/krIK9hLk0W33xuT0/G6QYd3YdhJZh+Xle717Ag==",
"requested": "[17.11.4, )",
"resolved": "17.11.4",
"contentHash": "UMC7DfeFEHY2GGHHaghybUuUlLaByFHEFudR2PehMgDBuRuLAUePp1iaa4eFtVzepRzMtIbeSCVJCzzX3NV2Gg==",
"dependencies": {
"Microsoft.Build.Framework": "17.10.4",
"Microsoft.NET.StringTools": "17.10.4",
"Microsoft.Build.Framework": "17.11.4",
"Microsoft.NET.StringTools": "17.11.4",
"System.Collections.Immutable": "8.0.0",
"System.Configuration.ConfigurationManager": "8.0.0",
"System.Reflection.Metadata": "8.0.0",
"System.Reflection.MetadataLoadContext": "8.0.0",
"System.Security.Principal.Windows": "5.0.0",
"System.Threading.Tasks.Dataflow": "8.0.0"
"System.Reflection.MetadataLoadContext": "8.0.0"
}
},
"Microsoft.Build.Framework": {
"type": "Direct",
"requested": "[17.10.4, )",
"resolved": "17.10.4",
"contentHash": "4qXCwNOXBR1dyCzuks9SwTwFJQO/xmf2wcMislotDWJu7MN/r3xDNoU8Ae5QmKIHPaLG1xmfDkYS7qBVzxmeKw=="
"requested": "[17.11.4, )",
"resolved": "17.11.4",
"contentHash": "u28uDihlqxtt8h2dL1ZJOZ7TRkxBK+HGr+3FgQpILVo7Q7gErkw8mYW9R+RM5PtxvZTdYb/4MWDL66vdIsANBQ=="
},
"Microsoft.Build.Utilities.Core": {
"type": "Direct",
"requested": "[17.10.4, )",
"resolved": "17.10.4",
"contentHash": "eEB/tcXkSV+nQgvoa/l53UPtn+KVtKZ8zBceDZsXVTrfE4fA+4+/olrx9W8n2tq4XiESsL9UuGJgCKzqBwQCoQ==",
"requested": "[17.11.4, )",
"resolved": "17.11.4",
"contentHash": "b2CEJMgVuv5fkhaR6TXjgocIa6YQbseowRj15q3/IyH343EPr+CrxXAZs6Xp6uZDE8A3ynsLPlufFUMkjUl37A==",
"dependencies": {
"Microsoft.Build.Framework": "17.10.4",
"Microsoft.NET.StringTools": "17.10.4",
"Microsoft.Build.Framework": "17.11.4",
"Microsoft.NET.StringTools": "17.11.4",
"System.Collections.Immutable": "8.0.0",
"System.Configuration.ConfigurationManager": "8.0.0"
}
Expand Down Expand Up @@ -126,8 +124,8 @@
},
"Microsoft.NET.StringTools": {
"type": "Transitive",
"resolved": "17.10.4",
"contentHash": "wyABaqY+IHCMMSTQmcc3Ca6vbmg5BaEPgicnEgpll+4xyWZWlkQqUwafweUd9VAhBb4jqplMl6voUHQ6yfdUcg=="
"resolved": "17.11.4",
"contentHash": "mudqUHhNpeqIdJoUx2YDWZO/I9uEDYVowan89R6wsomfnUJQk6HteoQTlNjZDixhT2B4IXMkMtgZtoceIjLRmA=="
},
"Microsoft.NETCore.Platforms": {
"type": "Transitive",
Expand Down Expand Up @@ -201,11 +199,6 @@
"resolved": "8.0.0",
"contentHash": "+TUFINV2q2ifyXauQXRwy4CiBhqvDEDZeVJU7qfxya4aRYOKzVBpN+4acx25VcPB9ywUN6C0n8drWl110PhZEg=="
},
"System.Security.Principal.Windows": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "t0MGLukB5WAVU9bO3MGzvlGnyJPgUlcwerXn1kzBRjwLKixT96XV0Uza41W49gVd8zEMFu9vQEFlv0IOrytICA=="
},
"System.Text.Encoding": {
"type": "Transitive",
"resolved": "4.3.0",
Expand All @@ -225,11 +218,6 @@
"Microsoft.NETCore.Targets": "1.1.0",
"System.Runtime": "4.3.0"
}
},
"System.Threading.Tasks.Dataflow": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "7V0I8tPa9V7UxMx/+7DIwkhls5ouaEMQx6l/GwGm1Y8kJQ61On9B/PxCXFLbgu5/C47g0BP2CUYs+nMv1+Oaqw=="
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ Then to get the list of available commands:
please --help
```

### Installing on Ubuntu Linux

This project uses MSBuild assemblies from Microsoft that don't seem to work when the
.NET SDK is installed using Snap. If `please` crashes with errors mentioning the .NET SDK,
try installing the SDK from the official Ubuntu package feed
([instructions](https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#supported-distributions)).

## Usage

Open a command prompt, navigate to your solution's root directory, and start
Expand Down
19 changes: 10 additions & 9 deletions build-and-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ if ($toolPath -eq $null) {
$toolPath = ''
}

if ($toolPath -ne '') {
$toolScope = '--tool-path'
}
else {
$toolScope = '--global'
}
$ErrorActionPreference = "Stop"

dotnet build --configuration Release DotNetPlease.sln
Remove-Item -Recurse -Path ./packages
Remove-Item -Recurse -Path ./packages -ErrorAction SilentlyContinue
dotnet pack --no-build --configuration Release DotNetPlease.sln
$nupkg = Get-ChildItem -Filter packages/*.nupkg | Select-Object -First 1
$packageName = "MorganStanley.DotNetPlease"
$version = $nupkg.Name.Substring($packageName.Length + 1, $nupkg.Name.Length - $packageName.Length - 1 - ".nupkg".Length)
dotnet tool update $toolScope $toolPath --add-source ./packages MorganStanley.DotNetPlease --version $version
$version = $nupkg.Name -replace "$packageName\.(.*?)\.nupkg", '$1'

if ($toolPath) {
dotnet tool update $packageName --tool-path $toolPath ./packages --version $version
}
else {
dotnet tool update $packageName --global --add-source ./packages --version $version
}
Loading