diff options
author | Chris Walters <cw@opscode.com> | 2010-06-23 13:28:15 -0700 |
---|---|---|
committer | Chris Walters <cw@opscode.com> | 2010-06-23 13:28:15 -0700 |
commit | 329fc8e5173eba810a53115228a684ddb187824a (patch) | |
tree | 532800887513b2d18d77cd29496c0f08fc35f9f6 | |
parent | e103a2b6d14beb50788e66d027a475e051f92619 (diff) | |
download | chef-329fc8e5173eba810a53115228a684ddb187824a.tar.gz |
Adding execution_time attr_reader to Chef::ShellOut
-rw-r--r-- | chef/lib/chef/shell_out.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/chef/lib/chef/shell_out.rb b/chef/lib/chef/shell_out.rb index 32cf7d509c..67741d167d 100644 --- a/chef/lib/chef/shell_out.rb +++ b/chef/lib/chef/shell_out.rb @@ -44,6 +44,7 @@ class Chef attr_accessor :user, :group, :cwd, :valid_exit_codes attr_reader :command, :umask, :environment attr_writer :timeout + attr_reader :execution_time attr_reader :stdout, :stderr, :status @@ -138,7 +139,7 @@ class Chef propagate_pre_exec_failure @result = nil - read_time = 0 + @execution_time = 0 # Ruby 1.8.7 and 1.8.6 from mid 2009 try to allocate objects during GC # when calling IO.select and IO#read. Some OS Vendors are not interested @@ -148,8 +149,8 @@ class Chef until @status ready = IO.select(open_pipes, nil, nil, READ_WAIT_TIME) unless ready - read_time += READ_WAIT_TIME - if read_time >= timeout && !@result + @execution_time += READ_WAIT_TIME + if @execution_time >= timeout && !@result raise Chef::Exceptions::CommandTimeout, "command timed out:\n#{format_for_exception}" end end |