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: Don't require sudo for dotnet workloads validation #342

Merged
merged 2 commits into from
Feb 18, 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
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/UnoCheck/bin/Debug/netcoreapp3.1/UnoCheck.dll",
"args":["-v", "--manifest", "https://raw.githubusercontent.com/unoplatform/uno.check/bf3684e2ad725baa66da3573759129d6bb1d8817/manifests/uno.ui.manifest.json"],
"args":["-v", "--non-interactive", "--manifest", "${workspaceFolder}/manifests/uno.ui.manifest.json"],
"cwd": "${workspaceFolder}/UnoCheck",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
"console": "internalConsole",
Expand Down
4 changes: 2 additions & 2 deletions UnoCheck/DotNet/DotNetWorkloadManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public async Task<string[]> GetInstalledWorkloads()
"--machine-readable"
};

var r = await Util.WrapShellCommandWithSudo(dotnetExe, DotNetCliWorkingDir, Util.Verbose, args.ToArray());
var r = await Util.ShellCommand(dotnetExe, DotNetCliWorkingDir, Util.Verbose, args.ToArray());

// Throw if this failed with a bad exit code
if (r.ExitCode != 0)
Expand All @@ -127,7 +127,7 @@ public async Task<string[]> GetInstalledWorkloads()
"--print-rollback"
};

var r = await Util.WrapShellCommandWithSudo(dotnetExe, DotNetCliWorkingDir, Util.Verbose, args.ToArray());
var r = await Util.ShellCommand(dotnetExe, DotNetCliWorkingDir, Util.Verbose, args.ToArray());

// Throw if this failed with a bad exit code
if (r.ExitCode != 0)
Expand Down
6 changes: 6 additions & 0 deletions UnoCheck/Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ public static bool Delete(string path, bool isFile)
return false;
}

public static Task<ShellProcessRunner.ShellProcessResult> ShellCommand(string cmd, string workingDir, bool verbose, string[] args)
{
var cli = new ShellProcessRunner(new ShellProcessRunnerOptions(cmd, string.Join(" ", args)) { WorkingDirectory = workingDir, Verbose = verbose } );
return Task.FromResult(cli.WaitForExit());
}

public static Task<ShellProcessRunner.ShellProcessResult> WrapShellCommandWithSudo(string cmd, string[] args)
=> WrapShellCommandWithSudo(cmd, null, false, args);

Expand Down
Loading