Skip to content

Commit 151c41c

Browse files
Fix visualizer relative path bug
1 parent 8e9dd8d commit 151c41c

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/process/GameHandler.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,13 @@ def log_jsonify(self):
177177
dump(self.final_info, json_file, ensure_ascii=False, indent='\t')
178178

179179
def visualize(self):
180-
if self.visualizer:
181-
proc = Popen(
182-
(self.visualizer, self.log_path.joinpath('game.json').absolute()),
183-
stdin=None, stdout=stdout, stderr=stderr,
184-
text=True, shell=False, bufsize=1, cwd=self.visualizer.parent)
185-
print(f'Executed the visualizer (pid: {proc.pid})')
186-
if proc.wait():
187-
print('Something went wrong...\nPlease consider updating the visualizer.',
188-
file=stderr)
180+
if not self.visualizer:
181+
return
182+
exec_path = self.visualizer.absolute()
183+
proc = Popen((exec_path, self.log_path.absolute().joinpath('game.json')),
184+
stdin=None, stdout=stdout, stderr=stderr, text=True,
185+
shell=False, bufsize=1, cwd=exec_path.parent)
186+
print(f'Waiting for the visualizer to exit. (pid: {proc.pid})')
187+
if proc.wait():
188+
print('Visualizer exited abnormally.\nPlease consider updating the visualizer.',
189+
file=stderr)

0 commit comments

Comments
 (0)