summaryrefslogtreecommitdiff
path: root/mesonbuild/mesonlib.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/mesonlib.py')
-rw-r--r--mesonbuild/mesonlib.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/mesonbuild/mesonlib.py b/mesonbuild/mesonlib.py
index d5e60fd1e..aaaf14407 100644
--- a/mesonbuild/mesonlib.py
+++ b/mesonbuild/mesonlib.py
@@ -323,22 +323,20 @@ class MachineChoice(OrderedEnum):
HOST = 1
TARGET = 2
-_T = typing.TypeVar('_T')
-
class PerMachine(typing.Generic[_T]):
- def __init__(self, build: typing.Optional[_T], host: typing.Optional[_T], target: typing.Optional[_T]):
+ def __init__(self, build: _T, host: _T, target: _T):
self.build = build
self.host = host
self.target = target
- def __getitem__(self, machine: MachineChoice) -> typing.Optional[_T]:
+ def __getitem__(self, machine: MachineChoice) -> _T:
return {
MachineChoice.BUILD: self.build,
MachineChoice.HOST: self.host,
MachineChoice.TARGET: self.target
}[machine]
- def __setitem__(self, machine: MachineChoice, val: typing.Optional[_T]) -> None:
+ def __setitem__(self, machine: MachineChoice, val: _T) -> None:
key = {
MachineChoice.BUILD: 'build',
MachineChoice.HOST: 'host',
@@ -968,7 +966,7 @@ def Popen_safe(args, write=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
return p, o, e
def Popen_safe_legacy(args, write=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs):
- p = subprocess.Popen(args, universal_newlines=False,
+ p = subprocess.Popen(args, universal_newlines=False, close_fds=False,
stdout=stdout, stderr=stderr, **kwargs)
if write is not None:
write = write.encode('utf-8')