-
-
Notifications
You must be signed in to change notification settings - Fork 281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run_script echo output to console, and capture errors from script #3277
base: main
Are you sure you want to change the base?
Conversation
capture_output=True, | ||
) | ||
logging.info(f"Output: \n{result.stdout.decode()}\n") | ||
if result.returncode != 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change this to return result.returncode == 0
this will return True
if the condition meet and False
otherwise. If you look at how the install
function executes the installer' steps, it checks if one of them returns False
Bottles/bottles/backend/managers/installer.py
Lines 421 to 424 in 2bd8b60
if not self.__perform_steps(_config, steps): | |
return Result( | |
False, data={"message": "Installer is not well configured."} | |
) |
Result
object according to that.
Currently, there is no easy way to show a message to the user graphically. It could be possible by making each step returning a tuple (boolean, message) and have the install
function append that message to the Result object, then updating the installer view in the frontend to use that message if available
Bottles/bottles/frontend/windows/installer.py
Lines 165 to 185 in 2bd8b60
def __install(self, *_args): | |
self.set_deletable(False) | |
self.stack.set_visible_child_name("page_install") | |
@GtkUtils.run_in_main_loop | |
def set_status(result, error=False): | |
if result.ok: | |
return self.__installed() | |
_err = result.data.get("message", _("Installer failed with unknown error")) | |
self.__error(_err) | |
self.set_steps(self.manager.installer_manager.count_steps(self.installer)) | |
RunAsync( | |
task_func=self.manager.installer_manager.install, | |
callback=set_status, | |
config=self.config, | |
installer=self.installer, | |
step_fn=self.next_step, | |
local_resources=self.__final_resources, | |
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding the line return result.returncode == 0
results in a known failure (exit 1) in the script not even putting a warning in the Console, and just continuing with the rest of the manifest steps.
Same goes for adding
return False
or
return Result(
False, data={"message": "Installer is not well configured."}
)
Bottles just continues on with the rest of the manifest regardless of the failure
It looks like there is something missing to handle the return at this point, as it continues regardless of any state returned
It's handled here Bottles/bottles/frontend/windows/installer.py Line 171 in 2bd8b60
|
It seems like I'm missing a couple of tricks today, but as far as i can tell it always completes regardless of the result being set to Null, True or False. I can't get it to fail the install process from a script by setting the "Result" Edit: Welp it seems i accidentally closed this... For now I should probably take a break from projects for a few days while i get other things sorted out |
Let me know if I should re-open it |
If you could, that would be great. I think the next step is working out why the Result doesn't look like it's being checked. As either False or no Result being set don't stop the manifest proceeding to the next step |
SonarQube Quality Gate |
Pylint result on modfied files:
|
Description
run_script steps are now run with output echoed into the terminal, allowing the user to see the status of a script.
Errors raised from the script are now have handling.
Any Raised errors other than 0, will create an error message but continue with the rest of the manifest (non blocking)
However it could be advisable to gracefully terminate the application installation with a GUI message?
Fixes #3275
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Provide instructions so we can reproduce.