Bottles icon indicating copy to clipboard operation
Bottles copied to clipboard

Run_script echo output to console, and capture errors from script

Open alextrical opened this issue 1 year ago • 6 comments

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

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

  • [x] Run any application manifest with a "run_script" step. The output will be echoed into the terminal.

alextrical avatar Feb 13 '24 20:02 alextrical

It's handled here https://github.com/bottlesdevs/Bottles/blob/2bd8b60608661228ea3e804edbd7ab0dc05faa0c/bottles/frontend/windows/installer.py#L171 it will simply never complete without an ok result. Can' t take a look in a short time.

mirkobrombin avatar Feb 14 '24 15:02 mirkobrombin

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

alextrical avatar Feb 14 '24 16:02 alextrical

Let me know if I should re-open it

mirkobrombin avatar Feb 14 '24 22:02 mirkobrombin

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

alextrical avatar Feb 19 '24 07:02 alextrical

Pylint result on modfied files:
************* Module bottles.backend.managers.installer
bottles/backend/managers/installer.py:100:20: I1101: Module 'pycurl' has no 'Curl' member, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member)
bottles/backend/managers/installer.py:102:38: R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
bottles/backend/managers/installer.py:252:17: W1510: 'subprocess.run' used without explicitly defining the value for 'check'. (subprocess-run-check)
bottles/backend/managers/installer.py:231:4: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
bottles/backend/managers/installer.py:361:4: R0913: Too many arguments (6/5) (too-many-arguments)

github-actions[bot] avatar Feb 19 '24 07:02 github-actions[bot]