Skip to content

Commit 7ea76b8

Browse files
committed
Support administrator handling for ShellRun api function
1 parent 3493446 commit 7ea76b8

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ public interface IPublicAPI
4242
/// <summary>
4343
/// Run a shell command
4444
/// </summary>
45+
/// <remarks>
46+
/// It can help to start a de-elevated process and show user account control dialog when Flow is running as administrator.
47+
/// </remarks>
4548
/// <param name="cmd">The command or program to run</param>
4649
/// <param name="filename">the shell type to run, e.g. powershell.exe</param>
4750
/// <exception cref="FileNotFoundException">Thrown when unable to find the file specified in the command </exception>

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,7 @@ public void ShellRun(string cmd, string filename = "cmd.exe")
158158
{
159159
var args = filename == "cmd.exe" ? $"/C {cmd}" : $"{cmd}";
160160

161-
var startInfo = ShellCommand.SetProcessStartInfo(filename, arguments: args, createNoWindow: true);
162-
ShellCommand.Execute(startInfo);
161+
StartProcess(filename, arguments: args, createNoWindow: true);
163162
}
164163

165164
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD100:Avoid async void methods", Justification = "<Pending>")]

0 commit comments

Comments
 (0)