Skip to content

Commit

Permalink
Updated FileWrapper async calls to allow errors to bubble up. (#492)
Browse files Browse the repository at this point in the history
Fixes #491
  • Loading branch information
JerrettDavis authored and fgreinacher committed Jul 9, 2019
1 parent cdeb078 commit caf3259
Showing 1 changed file with 11 additions and 22 deletions.
33 changes: 11 additions & 22 deletions System.IO.Abstractions/FileWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@ public override void AppendAllLines(string path, IEnumerable<string> contents, E
#if NETCOREAPP2_0
public override Task AppendAllLinesAsync(string path, IEnumerable<string> contents, CancellationToken cancellationToken)
{
File.AppendAllLinesAsync(path, contents, cancellationToken);
return Task.CompletedTask;
return File.AppendAllLinesAsync(path, contents, cancellationToken);
}

public override Task AppendAllLinesAsync(string path, IEnumerable<string> contents, Encoding encoding, CancellationToken cancellationToken)
{
File.AppendAllLinesAsync(path, contents, encoding, cancellationToken);
return Task.CompletedTask;
return File.AppendAllLinesAsync(path, contents, encoding, cancellationToken);
}
#endif

Expand All @@ -54,14 +52,12 @@ public override void AppendAllText(string path, string contents, Encoding encodi
#if NETCOREAPP2_0
public override Task AppendAllTextAsync(string path, string contents, CancellationToken cancellationToken)
{
File.AppendAllTextAsync(path, contents, cancellationToken);
return Task.CompletedTask;
return File.AppendAllTextAsync(path, contents, cancellationToken);
}

public override Task AppendAllTextAsync(string path, string contents, Encoding encoding, CancellationToken cancellationToken)
{
File.AppendAllTextAsync(path, contents, encoding, cancellationToken);
return Task.CompletedTask;
return File.AppendAllTextAsync(path, contents, encoding, cancellationToken);
}
#endif

Expand Down Expand Up @@ -378,8 +374,7 @@ public override void WriteAllBytes(string path, byte[] bytes)
#if NETCOREAPP2_0
public override Task WriteAllBytesAsync(string path, byte[] bytes, CancellationToken cancellationToken)
{
File.WriteAllBytesAsync(path, bytes, cancellationToken);
return Task.CompletedTask;
return File.WriteAllBytesAsync(path, bytes, cancellationToken);
}
#endif

Expand Down Expand Up @@ -553,26 +548,22 @@ public override void WriteAllLines(string path, string[] contents, Encoding enco
#if NETCOREAPP2_0
public override Task WriteAllLinesAsync(string path, IEnumerable<string> contents, CancellationToken cancellationToken)
{
File.WriteAllLinesAsync(path, contents, cancellationToken);
return Task.CompletedTask;
return File.WriteAllLinesAsync(path, contents, cancellationToken);
}

public override Task WriteAllLinesAsync(string path, IEnumerable<string> contents, Encoding encoding, CancellationToken cancellationToken)
{
File.WriteAllLinesAsync(path, contents, encoding, cancellationToken);
return Task.CompletedTask;
return File.WriteAllLinesAsync(path, contents, encoding, cancellationToken);
}

public override Task WriteAllLinesAsync(string path, string[] contents, CancellationToken cancellationToken)
{
File.WriteAllLinesAsync(path, contents, cancellationToken);
return Task.CompletedTask;
return File.WriteAllLinesAsync(path, contents, cancellationToken);
}

public override Task WriteAllLinesAsync(string path, string[] contents, Encoding encoding, CancellationToken cancellationToken)
{
File.WriteAllLinesAsync(path, contents, encoding, cancellationToken);
return Task.CompletedTask;
return File.WriteAllLinesAsync(path, contents, encoding, cancellationToken);
}
#endif

Expand Down Expand Up @@ -651,14 +642,12 @@ public override void WriteAllText(string path, string contents, Encoding encodin
#if NETCOREAPP2_0
public override Task WriteAllTextAsync(string path, string contents, CancellationToken cancellationToken)
{
File.WriteAllTextAsync(path, contents, cancellationToken);
return Task.CompletedTask;
return File.WriteAllTextAsync(path, contents, cancellationToken);
}

public override Task WriteAllTextAsync(string path, string contents, Encoding encoding, CancellationToken cancellationToken)
{
File.WriteAllTextAsync(path, contents, encoding, cancellationToken);
return Task.CompletedTask;
return File.WriteAllTextAsync(path, contents, encoding, cancellationToken);
}
#endif
}
Expand Down

0 comments on commit caf3259

Please sign in to comment.