summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel DeLeo <dan@opscode.com>2011-12-01 14:31:54 -0800
committerDaniel DeLeo <dan@opscode.com>2011-12-01 14:31:54 -0800
commit356512f308400d247919337c160bfd2b5c4c4801 (patch)
tree09e973d283dfb32e4527c475146f92398e3e62e2 /lib
parentfa5d75cc7b8e10690d8ad64d137684d0011f2eb6 (diff)
downloadmixlib-shellout-356512f308400d247919337c160bfd2b5c4c4801.tar.gz
document more methods in ShellOut base class
Diffstat (limited to 'lib')
-rw-r--r--lib/mixlib/shellout.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/mixlib/shellout.rb b/lib/mixlib/shellout.rb
index 396352f..2ea0f9d 100644
--- a/lib/mixlib/shellout.rb
+++ b/lib/mixlib/shellout.rb
@@ -147,15 +147,21 @@ module Mixlib
@command = command_args.size == 1 ? command_args.first : command_args
end
+ # Set the umask that the subprocess will have. If given as a string, it
+ # will be converted to an integer by String#oct.
def umask=(new_umask)
@umask = (new_umask.respond_to?(:oct) ? new_umask.oct : new_umask.to_i) & 007777
end
+ # The uid that the subprocess will switch to. If the user attribute was
+ # given as a username, it is converted to a uid by Etc.getpwnam
def uid
return nil unless user
user.kind_of?(Integer) ? user : Etc.getpwnam(user.to_s).uid
end
+ # The gid that the subprocess will switch to. If the group attribute is
+ # given as a group name, it is converted to a gid by Etc.getgrnam
def gid
return nil unless group
group.kind_of?(Integer) ? group : Etc.getgrnam(group.to_s).gid
@@ -178,6 +184,9 @@ module Mixlib
msg
end
+ # The exit status of the subprocess. Will be nil if the command is still
+ # running or died without setting an exit status (e.g., terminated by
+ # `kill -9`).
def exitstatus
@status && @status.exitstatus
end