Class: FFProbe::SafePipe
- Inherits:
-
Object
- Object
- FFProbe::SafePipe
- Defined in:
- lib/ffprobe/safe_pipe.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#program ⇒ Object
Returns the value of attribute program.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(program, *args) ⇒ SafePipe
constructor
A new instance of SafePipe.
- #run(&optional_block) ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(program, *args) ⇒ SafePipe
Returns a new instance of SafePipe.
8 9 10 11 |
# File 'lib/ffprobe/safe_pipe.rb', line 8 def initialize(program,*args) self.program = program self.args = args end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
6 7 8 |
# File 'lib/ffprobe/safe_pipe.rb', line 6 def args @args end |
#program ⇒ Object
Returns the value of attribute program.
6 7 8 |
# File 'lib/ffprobe/safe_pipe.rb', line 6 def program @program end |
#status ⇒ Object
Returns the value of attribute status.
6 7 8 |
# File 'lib/ffprobe/safe_pipe.rb', line 6 def status @status end |
Instance Method Details
#run(&optional_block) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ffprobe/safe_pipe.rb', line 13 def run(&optional_block) # closing of this pipe will indicate successful exec, # otherwise it will stream the error @rexec, @wexec = IO.pipe.map {|io| set_close_on_exec(io); io } @reader, @writer = IO.pipe if @pid = fork parent(&optional_block) else child end end |
#success? ⇒ Boolean
25 26 27 |
# File 'lib/ffprobe/safe_pipe.rb', line 25 def success? status ? status.success? : nil end |