Skip to content

Commit

Permalink
Fix #1866: Permit read locks on archive file write
Browse files Browse the repository at this point in the history
Prevents C# from insisting on a write-only lock when writing to the file
system. This means external programs (a simple `tail -f $FILE` for example) can
receive data from a running kOS program without causing errors.
  • Loading branch information
gisikw committed Nov 19, 2016
1 parent f847b04 commit cfb514b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/kOS.Safe/Persistence/ArchiveFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public override bool Write(byte[] content)
}

byte[] bytes = Archive.ConvertToWindowsNewlines(content);
using (FileStream stream = fileInfo.Open(FileMode.Append, FileAccess.Write))
using (FileStream stream = fileInfo.Open(FileMode.Append, FileAccess.Write, FileShare.ReadWrite))
{
stream.Write(bytes, 0, bytes.Length);
stream.Flush();
Expand All @@ -47,4 +47,4 @@ public override void Clear()
File.WriteAllText(fileInfo.FullName, string.Empty);
}
}
}
}

0 comments on commit cfb514b

Please sign in to comment.