Skip to content

Commit

Permalink
tests on windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
pchtsp committed Jul 12, 2024
1 parent 906fc6a commit 7d7c1b4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pulp/apis/copt_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,13 +902,14 @@ def __init__(
# workaround to deactivate logging when msg=False
if not self.msg:
oldstdout_fno = os.dup(sys.stdout.fileno())
# for some reason, using os.devnull does not work.
if operating_system == "win":
# windows doesn't have /dev/null
os.dup2(0, 1)
devnull = open('nul', "w")
else:
# linux and mac should have /dev/null
devnull = open("/dev/null", "w")
os.dup2(devnull.fileno(), 1)
os.dup2(devnull.fileno(), 1)
self.coptenv = coptpy.Envr()
self.coptmdl = self.coptenv.createModel()
os.dup2(oldstdout_fno, 1)
Expand Down

0 comments on commit 7d7c1b4

Please sign in to comment.