Skip to content

Commit 7810bfa

Browse files
authored
issue #88
Do not open .txt file with an entirely new subprocess.
1 parent 9948a73 commit 7810bfa

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/server_connector.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ def format_metadata_as_citations(metadata_list):
4444
return "\n".join(citations)
4545

4646
def write_contexts_to_file_and_open(contexts):
47+
contexts_output_file_path = Path('contexts.txt')
48+
4749
with contexts_output_file_path.open('w', encoding='utf-8') as file:
4850
for index, context in enumerate(contexts, start=1):
4951
file.write(f"------------ Context {index} ---------------\n\n")
@@ -52,9 +54,9 @@ def write_contexts_to_file_and_open(contexts):
5254
if os.name == 'nt':
5355
os.startfile(contexts_output_file_path)
5456
elif sys.platform == 'darwin':
55-
subprocess.Popen(['open', str(contexts_output_file_path)])
57+
os.system(f'open {contexts_output_file_path}')
5658
elif sys.platform.startswith('linux'):
57-
subprocess.Popen(['xdg-open', str(contexts_output_file_path)])
59+
os.system(f'xdg-open {contexts_output_file_path}')
5860
else:
5961
raise NotImplementedError("Unsupported operating system")
6062

0 commit comments

Comments
 (0)