|
|
@ -3,7 +3,6 @@ from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
|
|
import abc
|
|
|
|
import abc
|
|
|
|
import collections.abc as c
|
|
|
|
import collections.abc as c
|
|
|
|
import errno
|
|
|
|
|
|
|
|
import enum
|
|
|
|
import enum
|
|
|
|
import fcntl
|
|
|
|
import fcntl
|
|
|
|
import importlib.util
|
|
|
|
import importlib.util
|
|
|
@ -467,10 +466,8 @@ def raw_command(
|
|
|
|
cmd_bytes = [to_bytes(arg) for arg in cmd]
|
|
|
|
cmd_bytes = [to_bytes(arg) for arg in cmd]
|
|
|
|
env_bytes = dict((to_bytes(k), to_bytes(v)) for k, v in env.items())
|
|
|
|
env_bytes = dict((to_bytes(k), to_bytes(v)) for k, v in env.items())
|
|
|
|
process = subprocess.Popen(cmd_bytes, env=env_bytes, stdin=stdin, stdout=stdout, stderr=stderr, cwd=cwd) # pylint: disable=consider-using-with
|
|
|
|
process = subprocess.Popen(cmd_bytes, env=env_bytes, stdin=stdin, stdout=stdout, stderr=stderr, cwd=cwd) # pylint: disable=consider-using-with
|
|
|
|
except OSError as ex:
|
|
|
|
except FileNotFoundError as ex:
|
|
|
|
if ex.errno == errno.ENOENT:
|
|
|
|
raise ApplicationError('Required program "%s" not found.' % cmd[0]) from ex
|
|
|
|
raise ApplicationError('Required program "%s" not found.' % cmd[0])
|
|
|
|
|
|
|
|
raise
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if communicate:
|
|
|
|
if communicate:
|
|
|
|
data_bytes = to_optional_bytes(data)
|
|
|
|
data_bytes = to_optional_bytes(data)
|
|
|
@ -694,12 +691,11 @@ def verified_chmod(path: str, mode: int) -> None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def remove_tree(path: str) -> None:
|
|
|
|
def remove_tree(path: str) -> None:
|
|
|
|
"""Remove the specified directory, siliently continuing if the directory does not exist."""
|
|
|
|
"""Remove the specified directory, silently continuing if the directory does not exist."""
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
shutil.rmtree(to_bytes(path))
|
|
|
|
shutil.rmtree(to_bytes(path))
|
|
|
|
except OSError as ex:
|
|
|
|
except FileNotFoundError:
|
|
|
|
if ex.errno != errno.ENOENT:
|
|
|
|
pass
|
|
|
|
raise
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def is_binary_file(path: str) -> bool:
|
|
|
|
def is_binary_file(path: str) -> bool:
|
|
|
|