Class: AppleSimUtils::Cmd
- Inherits:
-
Object
- Object
- AppleSimUtils::Cmd
- Defined in:
- lib/apple_sim_utils/command.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize ⇒ Cmd
constructor
A new instance of Cmd.
- #run(*command) ⇒ Object
Constructor Details
#initialize ⇒ Cmd
Returns a new instance of Cmd.
5 6 7 |
# File 'lib/apple_sim_utils/command.rb', line 5 def initialize @path = get_command_path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
3 4 5 |
# File 'lib/apple_sim_utils/command.rb', line 3 def path @path end |
Instance Method Details
#run(*command) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/apple_sim_utils/command.rb', line 9 def run(*command) cmd = ([@path] + command).join(' ') sto, ste, status = Open3.capture3(cmd) if status.success? unless ste.empty? puts ste return ste end sto else puts ste raise(sto) end end |