randy3k / Terminus

Bring a real terminal to Sublime Text
https://packagecontrol.io/packages/Terminus
MIT License
1.37k stars 83 forks source link

Update default shell on Mac to zsh #398

Closed rchl closed 1 year ago

rchl commented 1 year ago

It's probably time to update the code to use zsh by default on Mac since it was the default shell for many years now:

https://github.com/randy3k/Terminus/blob/b0f58bdf6083fc68f9d236fe25f7a802200b0cb1/terminus/commands.py#L94-L95

randy3k commented 1 year ago

That's only used to run shell_cmd. For interactive terminals, we always use the default shell.

As bash and zsh are not 100% compatible, not sure if it is a good idea to change this to zsh.

rchl commented 1 year ago

But ST uses default system shell when running build, doesn't it? This code here is also used by terminus_exec so it should be as close to it as possible IMO.

And also Mac uses zsh by default so why should we worry about it not being fully compatible with bash?

And yes, it's only used for shell_cmd. That's how I've noticed it being problematic because it started showing errors (because there was some wrong path in .bash_profile that I've never noticed because nothing else runs bash here) and not looking correct.

randy3k commented 1 year ago

But ST uses default system shell when running build, doesn't it?

I don't think so. The following is copied from exec.py in Default

        if shell_cmd:
            if sys.platform == "win32":
                # Use shell=True on Windows, so shell_cmd is passed through
                # with the correct escaping
                cmd = shell_cmd
                shell = True
            elif sys.platform == "darwin":
                # Use a login shell on OSX, otherwise the users expected env
                # vars won't be setup
                cmd = ["/usr/bin/env", "bash", "-l", "-c", shell_cmd]
                shell = False
            elif sys.platform == "linux":
                # Explicitly use /bin/bash on Linux, to keep Linux and OSX as
                # similar as possible. A login shell is explicitly not used for
                # linux, as it's not required
                cmd = ["/usr/bin/env", "bash", "-c", shell_cmd]
                shell = False

why should we worry about it not being fully compatible with bash?

IIRC, Python's subprocess uses /bin/sh when shell=True, and on Mac, /bin/sh is bash.

rchl commented 1 year ago

Fair point.