Skip to content

Commit

Permalink
Fix code editor opening logic
Browse files Browse the repository at this point in the history
  • Loading branch information
haseeb-heaven committed Jan 7, 2024
1 parent 6c46b00 commit 2ce5e5c
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions libs/interpreter_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ def interpreter_main(self):
self.logger.info(f"Code Interpreter - v{self.interpreter_version}")
os_platform = self.utility_manager.get_os_platform()
os_name = os_platform[0]
extracted_code = None

# Seting the mode.
if self.SCRIPT_MODE:
Expand Down Expand Up @@ -446,16 +447,16 @@ def interpreter_main(self):
self.logger.info(f"Opening code in **vim** editor {code_file}")
subprocess.call(['vim', code_file])
continue

# Open the code in default editor.
if os_platform[0].lower() == 'macos':
self.logger.info(f"Opening code in default editor {code_file}")
subprocess.call(('open', code_file))
elif os_platform[0].lower() == 'linux':
subprocess.call(('xdg-open', code_file))
elif os_platform[0].lower() == 'windows':
os.startfile(code_file)
continue
else:
# Open the code in default editor.
if os_platform[0].lower() == 'macos':
self.logger.info(f"Opening code in default editor {code_file}")
subprocess.call(('open', code_file))
elif os_platform[0].lower() == 'linux':
subprocess.call(('xdg-open', code_file))
elif os_platform[0].lower() == 'windows':
os.startfile(code_file)
continue

# MODE - Command section.
elif any(command in task.lower() for command in ['/mode ', '/md ']):
Expand Down

0 comments on commit 2ce5e5c

Please sign in to comment.