c generator
This commit is contained in:
@@ -27,4 +27,28 @@ public static class GCC
|
||||
|
||||
return process.ExitCode == 0;
|
||||
}
|
||||
|
||||
public static async Task<bool> Compile(string cPath, string outPath)
|
||||
{
|
||||
using var process = new Process();
|
||||
process.StartInfo = new ProcessStartInfo("gcc", ["-ffreestanding", "-nostartfiles", "-c", "-o", outPath, cPath])
|
||||
{
|
||||
UseShellExecute = false,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
CreateNoWindow = true
|
||||
};
|
||||
|
||||
process.Start();
|
||||
|
||||
await process.WaitForExitAsync();
|
||||
|
||||
var errors = await process.StandardError.ReadToEndAsync();
|
||||
if (!string.IsNullOrWhiteSpace(errors))
|
||||
{
|
||||
await Console.Error.WriteLineAsync(errors);
|
||||
}
|
||||
|
||||
return process.ExitCode == 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user