acdream/tests/AcDream.Launcher.Core.Tests.Fixtures.InstallLeaseHolder/Program.cs

24 lines
730 B
C#

if (args.Length != 3)
{
return 2;
}
string lockPath = Path.GetFullPath(args[0]);
string stagingPath = Path.GetFullPath(args[1]);
string readyPath = Path.GetFullPath(args[2]);
Directory.CreateDirectory(
Path.GetDirectoryName(lockPath)
?? throw new InvalidOperationException("lock path has no parent"));
Directory.CreateDirectory(
Path.GetDirectoryName(stagingPath)
?? throw new InvalidOperationException("staging path has no parent"));
using var lease = new FileStream(
lockPath,
FileMode.OpenOrCreate,
FileAccess.ReadWrite,
FileShare.None);
File.WriteAllText(stagingPath, "abandoned bake staging");
File.WriteAllText(readyPath, "ready");
await Task.Delay(Timeout.InfiniteTimeSpan);
return 0;