Fix bugs in cli

This commit is contained in:
nub31
2025-08-18 16:29:41 +02:00
parent 10042de4d7
commit a01539ff24
4 changed files with 53 additions and 47 deletions

View File

@@ -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;
}
}
}