This repository has been archived on 2025-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
Files
nub-lang-archive-2/compiler/NubLang.CLI/Archive.cs
nub31 fd27d2709d ...
2025-09-11 21:22:30 +02:00

29 lines
832 B
C#

using System.Diagnostics;
namespace NubLang.CLI;
public static class Archive
{
public static async Task<bool> Invoke(string fileName, params 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;
}
}