Class Backup::Pipeline
In: lib/backup/pipeline.rb
Parent: Object

Methods

<<   error_messages   new   run   success?  

Included Modules

Backup::CLI::Helpers

Attributes

errors  [R] 
stderr  [R] 

Public Class methods

Public Instance methods

Adds a command to be executed in the pipeline. Each command will be run in the order in which it was added, with it‘s output being piped to the next command.

Returns a multi-line String, reporting all STDERR messages received from the commands in the pipeline (if any), along with the SystemCallError (Errno) message for each command which had a non-zero exit status.

Each error is wrapped by Backup::Errors to provide formatting.

Runs the command line from `pipeline` and collects STDOUT/STDERR. STDOUT is then parsed to determine the exit status of each command. For each command with a non-zero exit status, a SystemCallError is created and added to @errors. All STDERR output is set in @stderr.

Note that there is no accumulated STDOUT from the commands themselves. Also, the last command should not attempt to write to STDOUT. Any output on STDOUT from the final command will be sent to STDERR. This in itself will not cause run to fail, but will log warnings when all commands exit with non-zero status.

Use `success?` to determine if all commands in the pipeline succeeded. If `success?` returns `false`, use `error_messages` to get an error report.

[Validate]