Giter VIP home page Giter VIP logo

Comments (5)

mkoeppe avatar mkoeppe commented on June 3, 2024 1

I think it needs to re-raise in the SystemExit case too

from pyodide.

hoodmane avatar hoodmane commented on June 3, 2024

Thanks for the report. I think this bug has been present for the full three years I've been a maintainer of Pyodide and nobody has ever gotten around to fixing it... It is a bit confusing though.

from pyodide.

mkoeppe avatar mkoeppe commented on June 3, 2024

Any hint where to start to look to fix it?

from pyodide.

hoodmane avatar hoodmane commented on June 3, 2024

Looks to me that the problem is here:
https://github.com/pyodide/pyodide/blob/main/pyodide-build/pyodide_build/buildpkg.py?plain=1#L863-L873

    success = True
    try:
        _build_package_inner(...)
    except Exception:
        success = False
        raise
    finally:
        status = "Succeeded" if success else "Failed"

success is being left as True so the generic exception handler is not being executed. The ERROR message is printed here:
https://github.com/pyodide/pyodide/blob/main/pyodide-build/pyodide_build/buildpkg.py?plain=1#L124-L126

            logger.error(f"ERROR: {script_name} failed")
            logger.error(textwrap.indent(cmd, "    "))
            exit_with_stdio(result)

And exit_with_stdio raises SystemExit which is not caught by except Exception. So we should add handling for KeyboardInterrupt and SystemExit on line 863. I think the following patch would probably be sufficient:

--- a/pyodide-build/pyodide_build/buildpkg.py
+++ b/pyodide-build/pyodide_build/buildpkg.py
@@ -860,9 +860,11 @@ def build_package(
             continue_=continue_,
         )
 
-    except Exception:
+    except (Exception, KeyboardInterrupt):
         success = False
         raise
+    except SystemExit as e:
+        success = e.code == 0
     finally:
         t1 = datetime.now()
         datestamp = "[{}]".format(t1.strftime("%Y-%m-%d %H:%M:%S"))

Though we might consider adding a distinct message for KeyboardInterrupt and I'm not sure that anyone ever raises SystemExit(0) so it's not clear how important that case is.

from pyodide.

mkoeppe avatar mkoeppe commented on June 3, 2024

I've put a working version in #4404

from pyodide.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.