From 87559292c40ebb8563bad5ff829e560b02199f19 Mon Sep 17 00:00:00 2001 From: Peter Barabas Date: Thu, 10 Mar 2016 13:14:53 +0100 Subject: Get user id without forking a shell. Change-Id: I6789b81186b7ede124a838a5b6668ba8326e0c0b Signed-off-by: Peter Barabas (cherry picked from commit befc84a9d28663a45510c71119980e1cf5b6eeca) --- deploy/common.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'deploy/common.py') diff --git a/deploy/common.py b/deploy/common.py index cc418b59b..787a21a1d 100644 --- a/deploy/common.py +++ b/deploy/common.py @@ -133,8 +133,8 @@ def commafy(comma_separated_list): def check_if_root(): - r = exec_cmd('whoami') - if r != 'root': + uid = os.getuid() + if uid != 0: err('You need be root to run this application') -- cgit 1.2.3-korg