Use the already imported subprocess
This commit is contained in:
@@ -720,13 +720,12 @@ def read_shell_environment(opts: Optional[Options] = None) -> Dict[str, str]:
|
|||||||
return ans
|
return ans
|
||||||
with os.fdopen(master, 'rb') as stdout, os.fdopen(slave, 'wb'):
|
with os.fdopen(master, 'rb') as stdout, os.fdopen(slave, 'wb'):
|
||||||
raw = b''
|
raw = b''
|
||||||
from subprocess import TimeoutExpired
|
|
||||||
from time import monotonic
|
from time import monotonic
|
||||||
start_time = monotonic()
|
start_time = monotonic()
|
||||||
while monotonic() - start_time < 1.5:
|
while monotonic() - start_time < 1.5:
|
||||||
try:
|
try:
|
||||||
ret: Optional[int] = p.wait(0.01)
|
ret: Optional[int] = p.wait(0.01)
|
||||||
except TimeoutExpired:
|
except subprocess.TimeoutExpired:
|
||||||
ret = None
|
ret = None
|
||||||
with suppress(Exception):
|
with suppress(Exception):
|
||||||
raw += stdout.read()
|
raw += stdout.read()
|
||||||
|
|||||||
Reference in New Issue
Block a user