Skip to content

Commit

Permalink
Set GMT_SESSION_NAME to a unique value so multiprocessing works on Wi…
Browse files Browse the repository at this point in the history
…ndows
  • Loading branch information
seisman committed Jan 1, 2024
1 parent 12383e1 commit 07ae8f1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pygmt/session_management.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
"""
Modern mode session management modules.
"""
import os
import sys

from pygmt.clib import Session
from pygmt.helpers import unique_name


def begin():
Expand All @@ -12,6 +16,10 @@ def begin():
Only meant to be used once for creating the global session.
"""
# On Windows, need to set GMT_SESSION_NAME to a unique value
if sys.platform == "win32":
os.environ["GMT_SESSION_NAME"] = unique_name()

Check warning on line 21 in pygmt/session_management.py

View check run for this annotation

Codecov / codecov/patch

pygmt/session_management.py#L21

Added line #L21 was not covered by tests

prefix = "pygmt-session"
with Session() as lib:
lib.call_module(module="begin", args=prefix)
Expand Down

0 comments on commit 07ae8f1

Please sign in to comment.