Skip to content

Commit

Permalink
Code Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gerardog committed Feb 27, 2022
1 parent ba6032d commit 0575f14
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
14 changes: 4 additions & 10 deletions src/gsudo/Commands/RunCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,7 @@ public async Task<int> Execute()
return RunWithoutService(exeName, GetArguments(), elevationRequest);
}

exitCode = await RunUsingElevatedService(elevationRequest).ConfigureAwait(false);

if (exitCode.HasValue && exitCode.Value != Constants.GSUDO_ERROR_EXITCODE)
{
Logger.Instance.Log($"Process exited with code {exitCode}", LogLevel.Debug);
}

return exitCode ?? 0;
return await RunUsingElevatedService(elevationRequest).ConfigureAwait(false);
}

private static void SetRequestPrompt(ElevationRequest elevationRequest)
Expand Down Expand Up @@ -118,8 +111,9 @@ private async Task<int> RunUsingElevatedService(ElevationRequest elevationReques
await connection.WriteElevationRequest(elevationRequest).ConfigureAwait(false);
ConnectionKeepAliveThread.Start(connection);

var exitCode = await renderer.Start().ConfigureAwait(false);

var exitCode = await renderer.Start().ConfigureAwait(false);
Logger.Instance.Log($"Process exited with code {exitCode}", LogLevel.Debug);

return exitCode;
}
finally
Expand Down
2 changes: 1 addition & 1 deletion src/gsudo/Helpers/ProcessFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ internal static SafeProcessHandle CreateProcessAsUserWithFlags(string lpApplicat

var command = $"{lpApplicationName} {args}";

Logger.Instance.Log($"{nameof(CreateProcessAsUser)}: {lpApplicationName} {args}", LogLevel.Debug);
Logger.Instance.Log($"{nameof(CreateProcessAsUserWithFlags)}: {lpApplicationName} {args}", LogLevel.Debug);
if (!ProcessApi.CreateProcess(null, command, ref pSec, ref tSec, false, dwCreationFlags, IntPtr.Zero, null, ref sInfoEx, out pInfo))
{
throw new Win32Exception((int)ConsoleApi.GetLastError());
Expand Down

0 comments on commit 0575f14

Please sign in to comment.