oobabooga / one-click-installers

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

Remove unnecessary calls #54

Closed missionfloyd closed 1 year ago

missionfloyd commented 1 year ago

call Is for running other batch scripts. It isn't needed for exe's.

https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/call

jllllll commented 1 year ago

Didn't notice this PR until now and would like to clarify some things.

To begin, CMD is notoriously poorly documented and buggy. The call command posses a lot of functionality that is undocumented and avoids several bugs I was facing when writing the original overhaul to the Windows installer, while providing better consistency in command execution. It isn't just for batch scripts like Microsoft says. Internally, it searches the disk for a file that matches the specified command and executes it. If it doesn't find the file, it tries to execute the command as an internal CMD command and explicitly raises ERRORLEVEL to 1 if it doesn't work. That ERRORLEVEL part is very important to being able to stop the script and display a relevant error message reliably. On top of this, it also changes how variables are expanded at run time, by expanding all variables on that line immediately. Typically, CMD will only expand a single variable per line. This isn't very intuitive and can lead to very hard to diagnose bugs in the script owing to the poor documentation about this behavior. I use call a lot in the script, simply because I want to make it clear to anyone else maintaining it that this command works well to execute programs where typical methods fail.

As for the start /wait command, it is used here to clearly communicate my intention to wait for the Miniconda installer to finish before continuing. This functionality is strictly required for the script to function. There are plenty of ways to execute a program in CMD. However, most will continue the script while Miniconda is still installing, causing the script to fail. I encountered this issue multiple times in my initial tests.

If it wasn't for Microsoft's decision to block Powershell script execution by default, I would never have bothered with CMD's endless bugs and nuances. Sure, there are easy ways to bypass that restriction. However, they add unnecessary complication to the installer that can confuse newcomers to command-line applications.