lib/backticks/runner.rb in backticks-0.3.0 vs lib/backticks/runner.rb in backticks-0.3.1

- old
+ new

@@ -54,27 +54,27 @@ # # @return [Command] the running command # # @example Run docker-compose with complex parameters # command('docker-compose', {file: 'joe.yml'}, 'up', {d:true}, 'mysvc') - def run(*args) + def command(*args) argv = @cli.parameters(*args) + if self.buffered run_buffered(argv) else run_unbuffered(argv) end end - alias command run - # Run a command. Use a pty to capture the unbuffered output. # # @param [Array] argv command to run; argv[0] is program name and the # remaining elements are parameters and flags # @return [Command] the running command - private def run_unbuffered(argv) + private + def run_unbuffered(argv) stdout, stdout_w = PTY.open stdin_r, stdin = PTY.open stderr, stderr_w = PTY.open pid = spawn(*argv, in: stdin_r, out: stdout_w, err: stderr_w) stdin_r.close @@ -93,10 +93,10 @@ # exit status and stdout. # # @param [Array] argv command to run; argv[0] is program name and the # remaining elements are command-line arguments. # @return [Command] the running command - private def run_buffered(argv) + def run_buffered(argv) stdin, stdout, stderr, thr = Open3.popen3(*argv) unless @interactive stdin.close stdin = nil end