Fix bugs in cli
This commit is contained in:
@@ -4,13 +4,12 @@ namespace NubLang.CLI;
|
||||
|
||||
public static class QBE
|
||||
{
|
||||
public static async Task<string?> Invoke(string ssa)
|
||||
public static async Task<bool> Invoke(string ssaPath, string outPath)
|
||||
{
|
||||
using var process = new Process();
|
||||
process.StartInfo = new ProcessStartInfo("qbe")
|
||||
process.StartInfo = new ProcessStartInfo("qbe", ["-o", outPath, ssaPath])
|
||||
{
|
||||
UseShellExecute = false,
|
||||
RedirectStandardInput = true,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
CreateNoWindow = true
|
||||
@@ -18,9 +17,6 @@ public static class QBE
|
||||
|
||||
process.Start();
|
||||
|
||||
await process.StandardInput.WriteAsync(ssa);
|
||||
process.StandardInput.Close();
|
||||
|
||||
await process.WaitForExitAsync();
|
||||
|
||||
var errors = await process.StandardError.ReadToEndAsync();
|
||||
@@ -29,8 +25,6 @@ public static class QBE
|
||||
await Console.Error.WriteLineAsync("qbe error:\n" + errors);
|
||||
}
|
||||
|
||||
var asm = await process.StandardOutput.ReadToEndAsync();
|
||||
|
||||
return process.ExitCode == 0 ? asm : null;
|
||||
return process.ExitCode == 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user