Skip to content

Commit f1785f1

Browse files
authored
Update main.cr
1 parent a8ec9fe commit f1785f1

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

source-code/main.cr

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ def update_snap(config : Hash(YAML::Any, YAML::Any)) : Bool
191191
success
192192
end
193193
def main
194+
if LibC.getuid != 0
195+
puts "hup requires sudo"
196+
exit 1
197+
end
194198
# Determine the user's home directory even when run with sudo
195199
home = if ENV.has_key?("SUDO_USER")
196200
"/home/#{ENV["SUDO_USER"]}"

0 commit comments

Comments
 (0)