From d43005ac482d21d14b7f90813c0a0899cea81442 Mon Sep 17 00:00:00 2001 From: Athanasios Xygkis Date: Mon, 21 Sep 2020 17:04:34 +0200 Subject: [PATCH] Fix sudo command --- validate.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/validate.py b/validate.py index 886083c..0c8581d 100755 --- a/validate.py +++ b/validate.py @@ -38,8 +38,8 @@ class TC: cmd2 = 'tc qdisc change dev {} root netem delay {} {} loss {} {} reorder {} {}'.format(self.interface, *self.losses['delay'], *self.losses['loss'], *self.losses['reordering']) if self.needSudo: - os.system('echo %s | sudo -S {}'.format(cmd1)) - os.system('echo %s | sudo -S {}'.format(cmd2)) + os.system("echo {} | sudo -S {}".format(self.sudoPassword, cmd1)) + os.system("echo {} | sudo -S {}".format(self.sudoPassword, cmd2)) else: os.system(cmd1) os.system(cmd2) @@ -62,7 +62,7 @@ class TC: def cleanup(self): cmd = 'tc qdisc del dev {} root 2>/dev/null'.format(self.interface) if self.needSudo: - os.system('echo %s | sudo -S {}'.format(cmd)) + os.system("echo '{}' | sudo -S {}".format(self.sudoPassword, cmd)) else: os.system(cmd)