Skip to content

Commit

Permalink
Prevent race condition between poll() and read()
Browse files Browse the repository at this point in the history
  • Loading branch information
pagmatt committed Jan 27, 2023
1 parent 0823ec2 commit 680a348
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions sem/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,7 @@ def configure_and_build(self, show_progress=True, optimized=True,
j_argument = ['-j', str(self.max_parallel_processes)] if self.max_parallel_processes else []
build_process = subprocess.Popen(['python3', build_program] + j_argument + ['build'],
cwd=self.path,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout=subprocess.PIPE)

# Show a progress bar
if show_progress:
Expand Down Expand Up @@ -215,9 +214,8 @@ def get_build_output(self, process, build_program):
if output == b'' and process.poll() is not None:
if process.returncode > 0:
raise Exception("Compilation ended with an error"
".\nSTDERR\n%s\nSTDOUT\n%s" %
(process.stderr.read(),
process.stdout.read()))
".\nSTDOUT\n%s" %
(process.stdout.read()))
return
if output:
if build_program == "ns3":
Expand Down

0 comments on commit 680a348

Please sign in to comment.