Skip to content

Commit ad394a0

Browse files
committed
C#: Download dotnet-install.sh to the scratch dir
1 parent dd64b43 commit ad394a0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

csharp/autobuilder/Semmle.Autobuild.CSharp/DotNetRule.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,18 +190,20 @@ BuildScript GetInstall(string pwsh) =>
190190
}
191191
else
192192
{
193+
var dotnetInstallPath = builder.Actions.PathCombine(FileUtils.GetTemporaryWorkingDirectory(builder.Actions.GetEnvironmentVariable, builder.Options.Language.UpperCaseName, out var _), ".dotnet", "dotnet-install.sh");
194+
193195
var downloadDotNetInstallSh = BuildScript.DownloadFile(
194196
"https://dot.net/v1/dotnet-install.sh",
195-
"dotnet-install.sh",
197+
dotnetInstallPath,
196198
e => builder.Log(Severity.Warning, $"Failed to download 'dotnet-install.sh': {e.Message}"));
197199

198200
var chmod = new CommandBuilder(builder.Actions).
199201
RunCommand("chmod").
200202
Argument("u+x").
201-
Argument("dotnet-install.sh");
203+
Argument(dotnetInstallPath);
202204

203205
var install = new CommandBuilder(builder.Actions).
204-
RunCommand("./dotnet-install.sh").
206+
RunCommand(dotnetInstallPath).
205207
Argument("--channel").
206208
Argument("release").
207209
Argument("--version").
@@ -211,7 +213,7 @@ BuildScript GetInstall(string pwsh) =>
211213

212214
var removeScript = new CommandBuilder(builder.Actions).
213215
RunCommand("rm").
214-
Argument("dotnet-install.sh");
216+
Argument(dotnetInstallPath);
215217

216218
return downloadDotNetInstallSh & chmod.Script & install.Script & BuildScript.Try(removeScript.Script);
217219
}

0 commit comments

Comments
 (0)