From bfec456aae2ad7abcec0f8c4c8b2f44308e48961 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 4 Oct 2022 10:36:39 -0700 Subject: Add retries when trying to update bundle resources Fixes 6882 and 6902 --- .../WixToolset.Extensibility/Services/IFileSystem.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/api') diff --git a/src/api/wix/WixToolset.Extensibility/Services/IFileSystem.cs b/src/api/wix/WixToolset.Extensibility/Services/IFileSystem.cs index d633c823..26184462 100644 --- a/src/api/wix/WixToolset.Extensibility/Services/IFileSystem.cs +++ b/src/api/wix/WixToolset.Extensibility/Services/IFileSystem.cs @@ -2,6 +2,8 @@ namespace WixToolset.Extensibility.Services { + using System; + /// /// Abstracts basic file system operations. /// @@ -15,11 +17,28 @@ namespace WixToolset.Extensibility.Services /// Allow hardlinks. void CopyFile(string source, string destination, bool allowHardlink); + /// + /// Deletes a file. + /// + /// The file to delete. + /// Indicates the file must be deleted. Default is a best effort delete. + /// Maximum retry attempts. Default is 4. + void DeleteFile(string source, bool throwOnError = false, int maxRetries = 4); + /// /// Moves a file. /// /// The file to move. /// The destination file. void MoveFile(string source, string destination); + + /// + /// Executes an action and retries on any exception a few times with short pause + /// between each attempt. Primarily intended for use with file system operations + /// that might get interrupted by external systems (usually anti-virus). + /// + /// Action to execute. + /// Maximum retry attempts. Default is 4. + void ExecuteWithRetries(Action action, int maxRetries = 4); } } -- cgit v1.2.3-55-g6feb