================
@@ -602,18 +602,28 @@ def executeBuiltinUlimit(cmd, shenv):
     """executeBuiltinUlimit - Change the current limits."""
     if os.name != "posix":
         raise InternalShellError(cmd, "'ulimit' not supported on this system")
+    # Import resource here after we confirm we are on a POSIX system as the
+    # module does not exist on Windows.
+    import resource
----------------
arichardson wrote:

```suggestion
try:
    # Try importing the resource package (for POSIX systems) and emit
    # an error on Windows where it does not exist.
    import resource
except ImportError:
    raise InternalShellError(cmd, "'ulimit' not supported on this system")
```

I guess this would be the other option to avoid hardcoding os.name == posix

https://github.com/llvm/llvm-project/pull/165123
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to