Skip to content

Commit

Permalink
Fix a few Windows compatibility issues. (#718)
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoTavares committed Jun 20, 2020
1 parent 596d9a2 commit 7050e75
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
6 changes: 5 additions & 1 deletion pyoutline/bin/cuerunbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,11 @@ def __init__(self):
self.__evh = event.EventHandler(self)

# Setup a sigbus signal handler.
signal.signal(signal.SIGBUS, signal_handler)
try:
signal.signal(signal.SIGBUS, signal_handler)
except ValueError:
# Not every system implements SIGBUS.
pass

def add_my_options(self):
"""Implemented by subclass."""
Expand Down
4 changes: 1 addition & 3 deletions pyoutline/outline/backend/cue.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,7 @@ def _serialize(launcher, use_pycuerun):
if not launcher.get("nomail"):
sub_element(root, "email", "%s@%s" % (user,
config.get("outline", "domain")))
uid = util.get_uid()
if uid is not None:
sub_element(root, "uid", str(uid))
sub_element(root, "uid", str(util.get_uid()))

j = Et.SubElement(root, "job", {"name": ol.get_name()})
sub_element(j, "paused", str(launcher.get("pause")))
Expand Down
2 changes: 1 addition & 1 deletion pyoutline/outline/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,6 @@ def get_uid():
Return the current users id
"""
if platform.system() == 'Windows':
return None
return 1

return os.getuid()
2 changes: 2 additions & 0 deletions rqd/rqd/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ def setupLogging():
logfile = logging.handlers.SysLogHandler(address=syslogAddress)
else:
logfile = logging.handlers.SysLogHandler()
elif platform.system() == 'Windows':
logfile = logging.FileHandler(os.path.expandvars('%TEMP%/openrqd.log'))
else:
logfile = logging.handlers.SysLogHandler()
logfile.setLevel(fileLevel)
Expand Down
2 changes: 1 addition & 1 deletion rqd/rqd/rqcore.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def _createCommandFile(self, command):
rqd_tmp_dir = os.path.join(tempfile.gettempdir(), 'rqd')
try:
os.mkdir(rqd_tmp_dir)
except FileExistsError:
except OSError:
pass # okay, already exists

commandFile = os.path.join(
Expand Down

0 comments on commit 7050e75

Please sign in to comment.