fix(launcher): harden installer transactions
This commit is contained in:
parent
ff6ebb6a6a
commit
3f68895120
21 changed files with 1164 additions and 61 deletions
|
|
@ -0,0 +1,24 @@
|
|||
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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue