mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-02-06 21:50:25 +01:00
Use subprocess.check_output instead of run
subprocess.run only exists for python3, and this needs to also support python 2.7
This commit is contained in:
parent
531a17c151
commit
04849df7e3
@ -24,12 +24,13 @@ def ipt_chain_exists(family, table, name):
|
|||||||
'PATH': os.environ['PATH'],
|
'PATH': os.environ['PATH'],
|
||||||
'LC_ALL': "C",
|
'LC_ALL': "C",
|
||||||
}
|
}
|
||||||
completed = ssubprocess.run(argv, stdout=ssubprocess.PIPE, env=env, encoding='ASCII')
|
try:
|
||||||
if completed.returncode:
|
output = ssubprocess.check_output(argv, env=env)
|
||||||
raise Fatal('%r returned %d' % (argv, completed.returncode))
|
for line in output.decode('ASCII').split('\n'):
|
||||||
for line in completed.stdout.split('\n'):
|
if line.startswith('Chain %s ' % name):
|
||||||
if line.startswith('Chain %s ' % name):
|
return True
|
||||||
return True
|
except ssubprocess.CalledProcessError as e:
|
||||||
|
raise Fatal('%r returned %d' % (argv, e.returncode))
|
||||||
|
|
||||||
|
|
||||||
def ipt(family, table, *args):
|
def ipt(family, table, *args):
|
||||||
|
Loading…
Reference in New Issue
Block a user