oobabooga / one-click-installers

Simplified installers for oobabooga/text-generation-webui.
GNU Affero General Public License v3.0
550 stars 186 forks source link

Support non standard shells on Linux #116

Closed samfundev closed 1 year ago

samfundev commented 1 year ago

If you're not using bash on Linux, there would be problems when the script tried to run commands. This specifies that python should use bash to run commands.

As far as I can tell from the documentation, this shouldn't effect Windows:

If shell=True, on POSIX the executable argument specifies a replacement shell for the default /bin/sh.

I haven't tested this though.

jllllll commented 1 year ago

You missed the part under that:

Changed in version 3.8: executable parameter accepts a bytes and path-like object on Windows.

Tested on Windows and confirmed that this does break functionality. This makes sense because Windows also has multiple shells, with more that can be installed. One way to fix this is with:

def run_cmd(cmd, assert_success=False, environment=False, capture_output=False, env=None, executable="/bin/bash" if sys.platform.startswith("linux") else None):

    ...

    # Run shell commands
    result = subprocess.run(cmd, shell=True, capture_output=capture_output, env=env, executable=executable)

    ...

Edited with a better solution.

samfundev commented 1 year ago

Actually, I think there might have been something wrong with my setup that was causing this error. If I'm able to reproduce this issue again, I'll reopen this.