Method: TTY::Command::Cmd#user

Defined in:
lib/tty/command/cmd.rb

#user(value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



107
108
109
110
111
112
# File 'lib/tty/command/cmd.rb', line 107

def user(value)
  return value unless options[:user]

  vars = environment.any? ? "#{environment_string} " : ""
  %(sudo -u #{options[:user]} #{vars}-- sh -c '%s') % [value]
end