Invoking a command waits up to 30s for NuGet or another process (#4657)
* Invoking a command waits up to 30s for NuGet or another process * PR Feedback
This commit is contained in:
parent
a700604b93
commit
b918b2a6b6
10 changed files with 316 additions and 4 deletions
|
@ -0,0 +1,29 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Test.Utilities
|
||||
{
|
||||
public static partial class FileInfoExtensions
|
||||
{
|
||||
private class FileInfoLock : IDisposable
|
||||
{
|
||||
private FileStream _fileStream;
|
||||
|
||||
public FileInfoLock(FileInfo fileInfo)
|
||||
{
|
||||
_fileStream = fileInfo.Open(FileMode.Open, FileAccess.ReadWrite, FileShare.None);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_fileStream.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue