[DRE-commits] [ruby-aruba] 39/98: Move command path resolving to private method to make it re-usable
Hideki Yamane
henrich at moszumanska.debian.org
Tue Mar 22 12:20:37 UTC 2016
This is an automated email from the git hooks/post-receive script.
henrich pushed a commit to branch debian/sid
in repository ruby-aruba.
commit a84fd28368277605f459aaf7817380e59218e7c3
Author: Dennis Günnewig <dg1 at ratiodata.de>
Date: Mon Jan 4 10:21:38 2016 +0100
Move command path resolving to private method to make it re-usable
---
lib/aruba/processes/spawn_process.rb | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/lib/aruba/processes/spawn_process.rb b/lib/aruba/processes/spawn_process.rb
index 33ec7d9..38f6b21 100644
--- a/lib/aruba/processes/spawn_process.rb
+++ b/lib/aruba/processes/spawn_process.rb
@@ -58,16 +58,7 @@ module Aruba
@started = true
- # gather fully qualified path
- cmd = Aruba.platform.which(command, environment['PATH'])
-
- # rubocop:disable Metrics/LineLength
- fail LaunchError, %(Command "#{command}" not found in PATH-variable "#{environment['PATH']}".) if cmd.nil?
- # rubocop:enable Metrics/LineLength
-
- cmd = Aruba.platform.command_string.new(cmd)
-
- @process = ChildProcess.build(*[cmd.to_a, arguments].flatten)
+ @process = ChildProcess.build(*[command_string.to_a, arguments].flatten)
@stdout_file = Tempfile.new('aruba-stdout-')
@stderr_file = Tempfile.new('aruba-stderr-')
@@ -243,6 +234,17 @@ module Aruba
private
+ def command_string
+ # gather fully qualified path
+ cmd = Aruba.platform.which(command, environment['PATH'])
+
+ # rubocop:disable Metrics/LineLength
+ fail LaunchError, %(Command "#{command}" not found in PATH-variable "#{environment['PATH']}".) if cmd.nil?
+ # rubocop:enable Metrics/LineLength
+
+ Aruba.platform.command_string.new(cmd)
+ end
+
def wait_for_io(time_to_wait, &block)
sleep time_to_wait.to_i
block.call
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-aruba.git
More information about the Pkg-ruby-extras-commits
mailing list