diff options
author | Robin Houston <robin.houston@gmail.com> | 2012-01-17 15:00:50 +0000 |
---|---|---|
committer | Robin Houston <robin.houston@gmail.com> | 2012-01-17 15:00:50 +0000 |
commit | 604ec14bc34d4c7b64b7ca36d9fcda03e51daea6 (patch) | |
tree | 3fad9930fd3d726416ac2e99f840a23fb5cf51fa /lib/alaveteli_external_command.rb | |
parent | 6cf896d3f335ce05d144ad6f6c31939e0586a828 (diff) |
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.
Diffstat (limited to 'lib/alaveteli_external_command.rb')
-rw-r--r-- | lib/alaveteli_external_command.rb | 4 |
1 files changed, 2 insertions, 2 deletions
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(' ')}:") |