From 5f702742a165a9d8840507d38b22a0eb5b6bcdf0 Mon Sep 17 00:00:00 2001 From: Claus T Nielsen Date: Fri, 31 Aug 2018 16:25:02 +0200 Subject: [PATCH 1/2] [feature] fix file blocking issue with webcmdlets using infile --- .../utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs index 00e34033e9e..2216245d23f 100644 --- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs +++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/WebCmdlet/Common/WebRequestPSCmdlet.Common.cs @@ -1218,7 +1218,7 @@ internal virtual void FillRequestStream(HttpRequestMessage request) try { // open the input file - SetRequestContent(request, new FileStream(InFile, FileMode.Open)); + SetRequestContent(request, new FileStream(InFile, FileMode.Open, FileAccess.Read, FileShare.Read)); } catch (UnauthorizedAccessException) { From 5b6e7c79bdf390107dc2531346da19b327897c59 Mon Sep 17 00:00:00 2001 From: Claus T Nielsen Date: Sat, 1 Sep 2018 12:12:56 +0200 Subject: [PATCH 2/2] [feature]