Skip to content

Commit

Permalink
afs.core: optimize process command
Browse files Browse the repository at this point in the history
  • Loading branch information
MIRIMIRIM committed Jul 30, 2024
1 parent 8ca6640 commit fab6338
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions AssFontSubset.Core/src/PyFontTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,21 +201,25 @@ private void ExecuteCmd(ProcessStartInfo startInfo)

if (process != null)
{
var output = process.StandardOutput.ReadToEnd();
var output = process.StandardOutput;
var errorOutput = process.StandardError.ReadToEnd();

var outputStr = output.ReadToEnd();

logger?.ZLogDebug($"Executing...");
process.WaitForExit();
var exitCode = process.ExitCode;

var processTime = process.TotalProcessorTime;
sw.Stop();

if (exitCode != 0)
{
logger?.ZLogError($"Return exitcode {exitCode},error output: {errorOutput}");
logger?.ZLogError($"Return exitcode {exitCode},error output: {outputStr}");
success = false;
}
else
{
logger?.ZLogDebug($"Output:{Environment.NewLine}{errorOutput.TrimEnd()}");
logger?.ZLogDebug($"Successfully executed, use {sw.ElapsedMilliseconds} ms");
}
timer += sw.ElapsedMilliseconds;
Expand All @@ -231,7 +235,6 @@ private void ExecuteCmd(ProcessStartInfo startInfo)
{
throw new Exception($"Command execution failed: {startInfo.FileName} {string.Join(' ', startInfo.ArgumentList)}");
}
else { return; }

//return success;
}
Expand Down

0 comments on commit fab6338

Please sign in to comment.