Skip to content

Commit

Permalink
Improve handling for SHELL environment variable: (#421)
Browse files Browse the repository at this point in the history
* Use boolean conditional for checking shell_path to catch empty strings.

* Throw an error if shell_path does not exist.
  • Loading branch information
wjwwood authored Jan 7, 2017
1 parent f58b788 commit db3965f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions catkin_tools/resultspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ def get_resultspace_environment(result_space_path, base_env=None, quiet=False, c
)

# Determine the shell to use to source the setup file
shell_path = os.environ.get('SHELL', None)
if shell_path is None:
shell_path = os.environ.get('SHELL', '')
if not shell_path:
shell_path = DEFAULT_SHELL
if not os.path.isfile(shell_path):
raise RuntimeError(
"Cannot determine shell executable. "
"The 'SHELL' environment variable is not set and "
"the default '{0}' does not exist.".format(shell_path)
)
if not os.path.isfile(shell_path):
raise RuntimeError(
"Cannot determine shell executable. "
"The 'SHELL' environment variable is not set and "
"the default '{0}' does not exist.".format(shell_path)
)
(_, shell_name) = os.path.split(shell_path)

# Use fallback shell if using a non-standard shell
Expand Down

0 comments on commit db3965f

Please sign in to comment.