8000 include command output in restore exception message · dotnet-script/dotnet-script@715cc19 · GitHub
[go: up one dir, main page]

Skip to content

Commit 715cc19

Browse files
committed
include command output in restore exception message
1 parent f4ea82a commit 715cc19

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Dotnet.Script.DependencyModel/Context/DotnetRestorer.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@ public void Restore(ProjectFileInfo projectFileInfo, string[] packageSources)
3131

3232
_logger.Debug($"Restoring {projectFileInfo.Path} using the dotnet cli. RuntimeIdentifier : {runtimeIdentifier} NugetConfigFile: {projectFileInfo.NuGetConfigFile}");
3333

34-
var exitcode = _commandRunner.Execute("dotnet", $"restore \"{projectFileInfo.Path}\" -r {runtimeIdentifier} {packageSourcesArgument} {configFileArgument}", workingDirectory);
35-
if (exitcode != 0)
34+
var commandPath = "dotnet";
35+
var commandArguments = $"restore \"{projectFileInfo.Path}\" -r {runtimeIdentifier} {packageSourcesArgument} {configFileArgument}";
36+
var commandResult = _commandRunner.Capture(commandPath, commandArguments, workingDirectory);
37+
if (commandResult.ExitCode != 0)
3638
{
3739
// We must throw here, otherwise we may incorrectly run with the old 'project.assets.json'
38-
throw new Exception($"Unable to restore packages from '{projectFileInfo.Path}'. Make sure that all script files contains valid NuGet references");
40+
throw new Exception($"Unable to restore packages from '{projectFileInfo.Path}'{System.Environment.NewLine}Make sure that all script files contains valid NuGet references{System.Environment.NewLine}{System.Environment.NewLine}Details:{System.Environment.NewLine}{workingDirectory} : {commandPath} {commandArguments}{System.Environment.NewLine}{commandResult.StandardOut}");
3941
}
4042

4143
string CreatePackageSourcesArguments()

0 commit comments

Comments
 (0)
0