File
Blob: src/pyodide/internal/envHelpers.ts
| 1 | // Copyright (c) 2026 Cloudflare, Inc. |
| 2 | // Licensed under the Apache 2.0 license found in the LICENSE file or at: |
| 3 | // https://opensource.org/licenses/Apache-2.0 |
| 4 | |
| 5 | import innerEnv from 'cloudflare-internal:env'; |
| 6 | |
| 7 | // A generator that keeps the environment patched until it is resolved. |
| 8 | // Used to define the patch_env context manager, see |
| 9 | // src/pyodide/internal/workers-api/src/workers/_workers.py |
| 10 | export function* patch_env_helper(patch: unknown): Generator<void> { |
| 11 | using _ = innerEnv.pythonPatchEnv(patch); |
| 12 | yield; |
| 13 | } |