-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,120 additions
and
1,143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,40 @@ | ||
using System; | ||
|
||
namespace SimpleExec | ||
{ | ||
namespace SimpleExec; | ||
|
||
#if NET8_0_OR_GREATER | ||
/// <summary> | ||
/// The command exited with an unexpected exit code. | ||
/// </summary> | ||
/// <param name="exitCode">The exit code of the command.</param> | ||
/// <summary> | ||
/// The command exited with an unexpected exit code. | ||
/// </summary> | ||
/// <param name="exitCode">The exit code of the command.</param> | ||
#pragma warning disable CA1032 // Implement standard exception constructors | ||
public class ExitCodeException(int exitCode) : Exception | ||
public class ExitCodeException(int exitCode) : Exception | ||
#pragma warning restore CA1032 // Implement standard exception constructors | ||
{ | ||
/// <summary> | ||
/// Gets the exit code of the command. | ||
/// </summary> | ||
public int ExitCode { get; } = exitCode; | ||
#else | ||
{ | ||
/// <summary> | ||
/// The command exited with an unexpected exit code. | ||
/// Gets the exit code of the command. | ||
/// </summary> | ||
public int ExitCode { get; } = exitCode; | ||
#else | ||
/// <summary> | ||
/// The command exited with an unexpected exit code. | ||
/// </summary> | ||
#pragma warning disable CA1032 // Implement standard exception constructors | ||
public class ExitCodeException : Exception | ||
public class ExitCodeException : Exception | ||
#pragma warning restore CA1032 // Implement standard exception constructors | ||
{ | ||
/// <summary> | ||
/// Constructs an instance of a <see cref="ExitCodeException"/>. | ||
/// </summary> | ||
/// <param name="exitCode">The exit code of the command.</param> | ||
public ExitCodeException(int exitCode) => this.ExitCode = exitCode; | ||
{ | ||
/// <summary> | ||
/// Constructs an instance of a <see cref="ExitCodeException"/>. | ||
/// </summary> | ||
/// <param name="exitCode">The exit code of the command.</param> | ||
public ExitCodeException(int exitCode) => this.ExitCode = exitCode; | ||
|
||
/// <summary> | ||
/// Gets the exit code of the command. | ||
/// </summary> | ||
public int ExitCode { get; } | ||
/// <summary> | ||
/// Gets the exit code of the command. | ||
/// </summary> | ||
public int ExitCode { get; } | ||
#endif | ||
|
||
/// <inheritdoc/> | ||
public override string Message => $"The command exited with code {this.ExitCode}."; | ||
} | ||
/// <inheritdoc/> | ||
public override string Message => $"The command exited with code {this.ExitCode}."; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,35 @@ | ||
using System; | ||
|
||
namespace SimpleExec | ||
{ | ||
/// <summary> | ||
/// The command being read exited with an unexpected exit code. | ||
/// </summary> | ||
namespace SimpleExec; | ||
|
||
/// <summary> | ||
/// The command being read exited with an unexpected exit code. | ||
/// </summary> | ||
#pragma warning disable CA1032 // Implement standard exception constructors | ||
public class ExitCodeReadException : ExitCodeException | ||
public class ExitCodeReadException : ExitCodeException | ||
#pragma warning restore CA1032 // Implement standard exception constructors | ||
{ | ||
private static readonly string twoNewLines = $"{Environment.NewLine}{Environment.NewLine}"; | ||
{ | ||
private static readonly string twoNewLines = $"{Environment.NewLine}{Environment.NewLine}"; | ||
|
||
/// <summary> | ||
/// Constructs an instance of a <see cref="ExitCodeReadException"/>. | ||
/// </summary> | ||
/// <param name="exitCode">The exit code of the command.</param> | ||
/// <param name="standardOutput">The contents of standard output (stdout).</param> | ||
/// <param name="standardError">The contents of standard error (stderr).</param> | ||
public ExitCodeReadException(int exitCode, string standardOutput, string standardError) : base(exitCode) => (this.StandardOutput, this.StandardError) = (standardOutput, standardError); | ||
/// <summary> | ||
/// Constructs an instance of a <see cref="ExitCodeReadException"/>. | ||
/// </summary> | ||
/// <param name="exitCode">The exit code of the command.</param> | ||
/// <param name="standardOutput">The contents of standard output (stdout).</param> | ||
/// <param name="standardError">The contents of standard error (stderr).</param> | ||
public ExitCodeReadException(int exitCode, string standardOutput, string standardError) : base(exitCode) => (this.StandardOutput, this.StandardError) = (standardOutput, standardError); | ||
|
||
/// <summary> | ||
/// Gets the contents of standard output (stdout). | ||
/// </summary> | ||
public string StandardOutput { get; } | ||
/// <summary> | ||
/// Gets the contents of standard output (stdout). | ||
/// </summary> | ||
public string StandardOutput { get; } | ||
|
||
/// <summary> | ||
/// Gets the contents of standard error (stderr). | ||
/// </summary> | ||
public string StandardError { get; } | ||
/// <summary> | ||
/// Gets the contents of standard error (stderr). | ||
/// </summary> | ||
public string StandardError { get; } | ||
|
||
/// <inheritdoc/> | ||
public override string Message => | ||
$"{base.Message}{twoNewLines}Standard output (stdout):{twoNewLines}{this.StandardOutput}{twoNewLines}Standard error (stderr):{twoNewLines}{this.StandardError}"; | ||
} | ||
/// <inheritdoc/> | ||
public override string Message => | ||
$"{base.Message}{twoNewLines}Standard output (stdout):{twoNewLines}{this.StandardOutput}{twoNewLines}Standard error (stderr):{twoNewLines}{this.StandardError}"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.