mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-27 02:24:18 +00:00
Merge pull request #1345 from strohu/patch-2
Make sudo pfctl error check Python 3 compatible
This commit is contained in:
commit
9267b2b501
@ -23,12 +23,12 @@ class Resolver(object):
|
|||||||
try:
|
try:
|
||||||
stxt = subprocess.check_output(self.STATECMD, stderr=subprocess.STDOUT)
|
stxt = subprocess.check_output(self.STATECMD, stderr=subprocess.STDOUT)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
if "sudo: a password is required" in e.output:
|
if "sudo: a password is required" in e.output.decode(errors="replace"):
|
||||||
insufficient_priv = True
|
insufficient_priv = True
|
||||||
else:
|
else:
|
||||||
raise RuntimeError("Error getting pfctl state: " + repr(e))
|
raise RuntimeError("Error getting pfctl state: " + repr(e))
|
||||||
else:
|
else:
|
||||||
insufficient_priv = "sudo: a password is required" in stxt
|
insufficient_priv = "sudo: a password is required" in stxt.decode(errors="replace")
|
||||||
|
|
||||||
if insufficient_priv:
|
if insufficient_priv:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
|
Loading…
Reference in New Issue
Block a user