Skip to content

Commit

Permalink
Handle Windows, where signal package doesn't have SIGUSR1.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth Moore authored and Kenneth Moore committed Sep 9, 2020
1 parent e3f7d78 commit 5dce37f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion openmdao/drivers/pyoptsparse_driver.py
Expand Up @@ -66,6 +66,11 @@
}
"""

try:
DEFAULT_SIGNAL = signal.SIGUSR1
except AttributeError:
DEFAULT_SIGNAL = None


class UserRequestedException(Exception):
"""
Expand Down Expand Up @@ -188,7 +193,7 @@ def _declare_options(self):
self.options.declare('gradient method', default='openmdao',
values={'openmdao', 'pyopt_fd', 'snopt_fd'},
desc='Finite difference implementation to use')
self.options.declare('user_terminate_signal', default=signal.SIGUSR1, allow_none=True,
self.options.declare('user_terminate_signal', default=DEFAULT_SIGNAL, allow_none=True,
desc='OS signal that triggers a clean user-termination. Only SNOPT'
'supports this option.')

Expand Down

0 comments on commit 5dce37f

Please sign in to comment.