diff --git a/libbeat/tests/system/beat/beat.py b/libbeat/tests/system/beat/beat.py index f8c9863f1ae3..6c0672bde18f 100644 --- a/libbeat/tests/system/beat/beat.py +++ b/libbeat/tests/system/beat/beat.py @@ -45,12 +45,11 @@ def __init__(self, args, outputfile, env={}): self.env = env def start(self): + # ensure that the environment is inherited to the subprocess. + variables = os.environ.copy() + variables = variables.update(self.env) if sys.platform.startswith("win"): - # ensure that the environment is inherited to the subprocess. - variables = os.environ.copy() - variables = variables.update(self.env) - self.proc = subprocess.Popen( self.args, stdin=self.stdin_read, @@ -66,7 +65,7 @@ def start(self): stdout=self.output, stderr=subprocess.STDOUT, bufsize=0, - env=self.env) + env=variables) # If a "No such file or directory" error points you here, run # "make metricbeat.test" on metricbeat folder return self.proc