From 604ec14bc34d4c7b64b7ca36d9fcda03e51daea6 Mon Sep 17 00:00:00 2001 From: Robin Houston Date: Tue, 17 Jan 2012 15:00:50 +0000 Subject: Replace all `which command` calls The trouble with `which command` is twofold: - It spawns a whole shell just to find out the path to a binary, every time; - The results are environment-dependent, since they depend on $PATH. It would be better to specify the search path in the configuration file where everything else is specified rather than in the environment. This commit replaces it with the new mechanism from AlaveteliExternalCommand. --- lib/alaveteli_external_command.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/alaveteli_external_command.rb') diff --git a/lib/alaveteli_external_command.rb b/lib/alaveteli_external_command.rb index e83d8d49a..737b48fa9 100644 --- a/lib/alaveteli_external_command.rb +++ b/lib/alaveteli_external_command.rb @@ -23,14 +23,14 @@ module AlaveteliExternalCommand break end end - raise "Could not find #{program_name} in any of #{utility_search_path.join(', ')}" if !found + raise "Could not find #{program_name} in any of #{utility_search_path.join(', ')}" if !found end xc = ExternalCommand.new(program_path, *args) if opts.has_key? :append_to xc.out = opts[:append_to] end - xc.run() + xc.run(opts[:stdin_string]) if xc.status != 0 # Error $stderr.puts("Error from #{program_name} #{args.join(' ')}:") -- cgit v1.2.3