@@ -30,15 +30,16 @@ def main(argv):
3030__author__ = "Orsiris de Jong"
3131__copyright__ = "Copyright (C) 2017-2023 Orsiris de Jong"
3232__licence__ = "BSD 3 Clause"
33- __version__ = "0.3.2 "
34- __build__ = "2023122801 "
33+ __version__ = "0.3.3 "
34+ __build__ = "2024091501 "
3535
3636from logging import getLogger
3737import os
3838import sys
3939from command_runner import command_runner
4040
41- if os .name == "nt" :
41+ OS_NAME = os .name
42+ if OS_NAME == "nt" :
4243 try :
4344 import win32event # monitor process
4445 import win32process # monitor process
@@ -61,23 +62,22 @@ def is_admin():
6162
6263 :return: Boolean, True if admin privileges present
6364 """
64- current_os_name = os .name
6565
6666 # Works with XP SP2 +
67- if current_os_name == "nt" :
67+ if OS_NAME == "nt" :
6868 try :
6969 return IsUserAnAdmin ()
7070 except Exception :
7171 raise EnvironmentError ("Cannot check admin privileges" )
72- elif current_os_name == "posix" :
72+ elif OS_NAME == "posix" :
7373 # Check for root on Posix
7474 # os.getuid only exists on postix OSes
7575 # pylint: disable=E1101 (no-member)
7676 return os .getuid () == 0
7777 else :
7878 raise EnvironmentError (
7979 "OS does not seem to be supported for admin check. OS: {}" .format (
80- current_os_name
80+ OS_NAME
8181 )
8282 )
8383
@@ -97,7 +97,7 @@ def get_absolute_path(executable):
9797 if os .path .isfile (output ):
9898 return output
9999
100- if os . name == "nt" :
100+ if OS_NAME == "nt" :
101101 split_char = ";"
102102 else :
103103 split_char = ":"
@@ -205,7 +205,7 @@ def elevate(callable_function, *args, **kwargs):
205205 else :
206206 runner , arguments = _check_environment ()
207207 # Windows runner
208- if os . name == "nt" :
208+ if OS_NAME == "nt" :
209209 # Re-run the script with admin rights
210210 # Join arguments and double quote each argument in order to prevent space separation
211211 arguments = " " .join ('"' + arg + '"' for arg in arguments )
0 commit comments