https://pantsbuild.org/ logo
#general
Title
# general
h

high-yak-85899

03/02/2022, 11:09 PM
Let's say I have a program that makes a class that can be used as a context manager. And I want to run that like
Copy code
with MyClass():
   while True:
      time.sleep(1)
When I run this, I see
MyClass.__enter__
called, but if I Ctrl+C, I never see
MyClass.__exit__
called. This only happens with Pants. If I run my program as
python my_prog.py
, then I see
MyClass.__exit__
successfully called. Is there any way to recover this behavior? It makes sense to me why this is happening, but I'd really like to make sure I can gracefully shut down things.
h

happy-kitchen-89482

03/02/2022, 11:16 PM
Which Pants version is this? It should be fixed in 2.11.x (see https://github.com/pantsbuild/pants/issues/13230)
h

high-yak-85899

03/02/2022, 11:18 PM
2.9.0
Where would I find a timeline for a stable release date?
I'm hesitant to bump that far up just to incorporate this fix
h

hundreds-father-404

03/02/2022, 11:41 PM
See https://www.pantsbuild.org/docs/release-strategy for the release strategy. We're about 2 weeks out from the first rc I think, although it's plausible we bump it a week so that we have time to get Pex lockfiles enabled in Pants 2.11 so that we can call the lockfile rewrite project done. Once an rc is out, it usually is 1-3 weeks to stabilize. Note though that we're willing to cherry-pick the PR into 2.10 if users ask for it. So if you could try out the fix using the latest 2.11 release and see that it fixes things, we can cherry-pick 🙂
h

high-yak-85899

03/26/2022, 12:47 AM
Where would I ask for the backport? I would consider this a bug since it's not running the python scripts properly without the proper clean up.
h

happy-kitchen-89482

03/26/2022, 3:11 AM
I guess here 🙂
2 Views