mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add return value for start process api function
This commit is contained in:
parent
21e8d92aa2
commit
0d1358fdc3
2 changed files with 8 additions and 3 deletions
|
|
@ -591,7 +591,8 @@ namespace Flow.Launcher.Plugin
|
|||
/// <param name="workingDirectory">Working directory. If not specified, the current directory will be used</param>
|
||||
/// <param name="arguments">Optional arguments to pass to the process. If not specified, no arguments will be passed</param>
|
||||
/// <param name="runAsAdmin">Whether to run the process as administrator</param>
|
||||
public void StartProcess(string filePath, string workingDirectory = "", string arguments = "", bool runAsAdmin = false);
|
||||
/// <returns>Whether process is started successfully</returns>
|
||||
public bool StartProcess(string filePath, string workingDirectory = "", string arguments = "", bool runAsAdmin = false);
|
||||
|
||||
/// <summary>
|
||||
/// Displays a User Account Control (UAC) dialog to request elevated permissions for the specified application.
|
||||
|
|
|
|||
|
|
@ -577,7 +577,7 @@ namespace Flow.Launcher
|
|||
public Task<long> StopwatchLogInfoAsync(string className, string message, Func<Task> action, [CallerMemberName] string methodName = "") =>
|
||||
Stopwatch.InfoAsync(className, message, action, methodName);
|
||||
|
||||
public void StartProcess(string filePath, string workingDirectory = "", string arguments = "", bool runAsAdmin = false)
|
||||
public bool StartProcess(string filePath, string workingDirectory = "", string arguments = "", bool runAsAdmin = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -590,8 +590,10 @@ namespace Flow.Launcher
|
|||
if (!string.IsNullOrEmpty(errorInfo))
|
||||
{
|
||||
LogError(ClassName, $"Failed to start process {filePath} with error: {errorInfo}");
|
||||
return false;
|
||||
}
|
||||
return;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
var info = new ProcessStartInfo
|
||||
|
|
@ -603,10 +605,12 @@ namespace Flow.Launcher
|
|||
Verb = runAsAdmin ? "runas" : "",
|
||||
};
|
||||
Process.Start(info)?.Dispose();
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
LogException(ClassName, $"Failed to start process {filePath} with arguments {arguments} under {workingDirectory}", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue