...
This commit is contained in:
@@ -6,8 +6,8 @@ public static class QBE
|
||||
{
|
||||
public static async Task<string?> Invoke(string ssa)
|
||||
{
|
||||
using var qbeProcess = new Process();
|
||||
qbeProcess.StartInfo = new ProcessStartInfo
|
||||
using var process = new Process();
|
||||
process.StartInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = "qbe",
|
||||
UseShellExecute = false,
|
||||
@@ -17,21 +17,21 @@ public static class QBE
|
||||
CreateNoWindow = true
|
||||
};
|
||||
|
||||
qbeProcess.Start();
|
||||
process.Start();
|
||||
|
||||
await qbeProcess.StandardInput.WriteAsync(ssa);
|
||||
qbeProcess.StandardInput.Close();
|
||||
await process.StandardInput.WriteAsync(ssa);
|
||||
process.StandardInput.Close();
|
||||
|
||||
await qbeProcess.WaitForExitAsync();
|
||||
await process.WaitForExitAsync();
|
||||
|
||||
var qbeErrors = await qbeProcess.StandardError.ReadToEndAsync();
|
||||
if (!string.IsNullOrWhiteSpace(qbeErrors))
|
||||
var errors = await process.StandardError.ReadToEndAsync();
|
||||
if (!string.IsNullOrWhiteSpace(errors))
|
||||
{
|
||||
await Console.Error.WriteLineAsync("qbe error:\n" + qbeErrors);
|
||||
await Console.Error.WriteLineAsync("qbe error:\n" + errors);
|
||||
}
|
||||
|
||||
var asm = await qbeProcess.StandardOutput.ReadToEndAsync();
|
||||
var asm = await process.StandardOutput.ReadToEndAsync();
|
||||
|
||||
return qbeProcess.ExitCode == 0 ? asm : null;
|
||||
return process.ExitCode == 0 ? asm : null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user