Method: CommandMapper::Command#sudo_command
- Defined in:
- lib/command_mapper/command.rb
permalink #sudo_command(askpass: nil, background: nil, bell: nil, close_from: nil, chdir: nil, preserve_env: nil, group: nil, set_home: nil, host: nil, login: nil, remove_timestamp: nil, reset_timestamp: nil, non_interactive: nil, preserve_groups: nil, prompt: nil, chroot: nil, role: nil, stdin: nil, shell: nil, type: nil, command_timeout: nil, other_user: nil, user: nil, &block) ⇒ Boolean?
Runs the command through sudo
.
856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 |
# File 'lib/command_mapper/command.rb', line 856 def sudo_command(askpass: nil, background: nil, bell: nil, close_from: nil, chdir: nil, preserve_env: nil, group: nil, set_home: nil, host: nil, login: nil, remove_timestamp: nil, reset_timestamp: nil, non_interactive: nil, preserve_groups: nil, prompt: nil, chroot: nil, role: nil, stdin: nil, shell: nil, type: nil, command_timeout: nil, other_user: nil, user: nil, &block) sudo_params = {command: command_argv} sudo_params[:askpass] = askpass unless askpass.nil? sudo_params[:background] = background unless background.nil? sudo_params[:bell] = bell unless bell.nil? sudo_params[:close_from] = close_from unless close_from.nil? sudo_params[:chdir] = chdir unless chdir.nil? sudo_params[:preserve_env] = preserve_env unless preserve_env.nil? sudo_params[:group] = group unless group.nil? sudo_params[:set_home] = set_home unless set_home.nil? sudo_params[:host] = host unless host.nil? sudo_params[:login] = login unless login.nil? sudo_params[:remove_timestamp] = unless .nil? sudo_params[:reset_timestamp] = unless .nil? sudo_params[:non_interactive] = non_interactive unless non_interactive.nil? sudo_params[:preserve_groups] = preserve_groups unless preserve_groups.nil? sudo_params[:prompt] = prompt unless prompt.nil? sudo_params[:chroot] = chroot unless chroot.nil? sudo_params[:role] = role unless role.nil? sudo_params[:stdin] = stdin unless stdin.nil? sudo_params[:shell] = shell unless shell.nil? sudo_params[:type] = type unless type.nil? sudo_params[:command_timeout] = command_timeout unless command_timeout.nil? sudo_params[:other_user] = other_user unless other_user.nil? sudo_params[:user] = user unless user.nil? Sudo.run(sudo_params, command_env: @command_env, &block) end |