This repository has been archived on 2025-10-23. You can view files and clone it, but cannot push or open issues or pull requests.
Files
nub-lang-archive/src/compiler/CLI/Archive.cs
nub31 ed8da26b98 ...
2025-06-29 16:03:56 +02:00

29 lines
817 B
C#

using System.Diagnostics;
namespace CLI;
public static class Archive
{
public static async Task<bool> Invoke(string fileName, IEnumerable<string> objectFiles)
{
using var process = new Process();
process.StartInfo = new ProcessStartInfo("ar", ["rcs", fileName, ..objectFiles])
{
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("ar error when archiving:\n" + errors);
}
return process.ExitCode == 0;
}
}