- cmd_string = "apt-get #{action}"
- cmd_string << ' -y' if action == 'upgrade'
- stdout, stderr, status = Open3.capture3(cmd_string)
+ cmd = ['apt-get', action]
+ cmd << '-y' if ['upgrade', 'dist-upgrade', 'autoremove'].include?(action)
+ stdout, stderr, status = Open3.capture3(*cmd)