-
Notifications
You must be signed in to change notification settings - Fork 0
Start ExternalProcess
PPoShTools -> Start-ExternalProcess.ps1
Runs external process.
Start-ExternalProcess [-Command] <String> [[-ArgumentList] <String>]
[[-WorkingDirectory] <String>] [-CheckLastExitCode] [-ReturnLastExitCode]
[-CheckStdErr] [[-FailOnStringPresence] <String>] [[-Credential]
<PSCredential>] [[-Output] <PSReference>] [[-OutputStdErr] <PSReference>]
[[-TimeoutInSeconds] <Int32>] [-Quiet] [-ReportOutputOnError]
[[-IgnoreOutputRegex] <String>] [<CommonParameters>]
Runs an external process with proper logging and error handling. It fails if anything is present in stderr stream or if exitcode is non-zero.
Command to run.
- PipelineInput: false
- Required: true
ArgumentList for Command.
- PipelineInput: false
- Required: false
Working directory. Leave empty for default.
- PipelineInput: false
- Required: false
If true, exit code will be validated (if zero, an error will be thrown). If false, it will not be validated but returned as a result of the function.
- DefaultValue: True
- PipelineInput: false
- Required: false
If true, the cmdlet will return exit code of the invoked command. If false, the cmdlet will return nothing.
- DefaultValue: True
- PipelineInput: false
- Required: false
If true and any output is present in stderr, an error will be thrown.
- DefaultValue: True
- PipelineInput: false
- Required: false
If not null and given string will be present in stdout, an error will be thrown.
- PipelineInput: false
- Required: false
If set, then $Command will be executed under $Credential account.
- PipelineInput: false
- Required: false
Reference parameter that will get STDOUT text.
- PipelineInput: false
- Required: false
Reference parameter that will get STDERR text.
- PipelineInput: false
- Required: false
Timeout to wait for external process to be finished.
- DefaultValue: 0
- PipelineInput: false
- Required: false
If true, no output from the command will be passed to the console.
- DefaultValue: False
- PipelineInput: false
- Required: false
If true, STDOUT/STDERR will be displayed if error occurs (even if -Quiet is specified).
- DefaultValue: True
- PipelineInput: false
- Required: false
Each stdout/stderr line that match this regex will be ignored (not written to console/$output).
- PipelineInput: false
- Required: false
Start-ExternalProcess -Command "git" -ArgumentList "--version"