Exemplo n.º 1
0
 /// <summary>
 /// Creates a copy of this command, setting the validation options to the specified value.
 /// </summary>
 public Command WithValidation(CommandResultValidation validation) => new Command(
     TargetFilePath,
     Arguments,
     WorkingDirPath,
     EnvironmentVariables,
     validation,
     StandardInputPipe,
     StandardOutputPipe,
     StandardErrorPipe);
Exemplo n.º 2
0
        public static Disposable <(ICmd, CommandResultValidation)> ChangeResultValidation(
            this ICmd cmd, CommandResultValidation newResultValidation)
        {
            var oldValue = cmd.ResultValidation;

            cmd.ResultValidation = newResultValidation;
            return(Disposable.New(
                       (Cmd: cmd, OldValue: oldValue),
                       state => state.Cmd.ResultValidation = state.OldValue));
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes an instance of <see cref="Command"/>.
 /// </summary>
 public Command(
     string targetFilePath,
     string arguments,
     string workingDirPath,
     IReadOnlyDictionary <string, string> environmentVariables,
     CommandResultValidation validation,
     PipeSource standardInputPipe,
     PipeTarget standardOutputPipe,
     PipeTarget standardErrorPipe)
 {
     TargetFilePath       = targetFilePath;
     Arguments            = arguments;
     WorkingDirPath       = workingDirPath;
     EnvironmentVariables = environmentVariables;
     Validation           = validation;
     StandardInputPipe    = standardInputPipe;
     StandardOutputPipe   = standardOutputPipe;
     StandardErrorPipe    = standardErrorPipe;
 }
 public static bool IsZeroExitCodeValidationEnabled(this CommandResultValidation validation) =>
 (validation & CommandResultValidation.ZeroExitCode) != 0;