mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 05:53:43 +00:00
scripts: Use run_as_root instead of run([sudo, ...]).
This commit is contained in:
committed by
Tim Abbott
parent
9038230de8
commit
ac48925977
@@ -419,6 +419,13 @@ def is_root() -> bool:
|
||||
return True
|
||||
return False
|
||||
|
||||
def run_as_root(args, **kwargs):
|
||||
# type: (List[str], **Any) -> None
|
||||
sudo_args = kwargs.pop('sudo_args', [])
|
||||
if not is_root():
|
||||
args = ['sudo'] + sudo_args + ['--'] + args
|
||||
run(args, **kwargs)
|
||||
|
||||
def assert_not_running_as_root() -> None:
|
||||
script_name = os.path.abspath(sys.argv[0])
|
||||
if is_root():
|
||||
|
||||
Reference in New Issue
Block a user