Skip to content

Commit

Permalink
Use osascript in order not to pollute shell history on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
mrclary committed Sep 29, 2024
1 parent befac63 commit d072730
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions spyder/plugins/updatemanager/widgets/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,14 +436,15 @@ def start_install(self):
if os.name == 'nt':
cmd = ['start', '"Update Spyder"'] + sub_cmd
elif sys.platform == 'darwin':
# Terminal cannot accept a command with arguments therefore
# create a temporary script
tmpscript = osp.join(get_temp_dir(), 'tmp_install.sh')
with open(tmpscript, 'w') as f:
f.write(' '.join(sub_cmd))
os.chmod(tmpscript, 0o711) # set executable permissions

cmd = ['open', '-b', 'com.apple.terminal', tmpscript]
# Terminal cannot accept a command with arguments. Creating a
# wrapper script pollutes the shell history. Best option is to
# use osascript
sub_cmd_str = ' '.join(sub_cmd)
cmd = [
"osascript", "-e",
("""'tell application "Terminal" to do script"""
f""" "set +o history; {sub_cmd_str}; exit;"'"""),
]
else:
programs = [
{'cmd': 'gnome-terminal', 'exe-opt': '--window --'},
Expand Down

0 comments on commit d072730

Please sign in to comment.