Skip to content

Commit

Permalink
Fix the wrong return in locate function of ROSLaunchManager (#358)
Browse files Browse the repository at this point in the history
* Fix the wrong return in locate function

* Getting rid of the code smell

* Couple of renamings

Co-authored-by: Chris Timperley <christimperley@googlemail.com>
  • Loading branch information
afsafzal and ChrisTimperley authored Jun 1, 2020
1 parent df5f495 commit c001dfc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/roswire/proxy/roslaunch/roslaunch.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,14 @@ def locate(self, filename: str, *, package: Optional[str] = None) -> str:
f' in package [{package}]')
command = f'rospack find {shlex.quote(package)}'
try:
path = self._shell.check_output(command, stderr=False, text=True)
package_path = self._shell.check_output(command,
stderr=False,
text=True)
except dockerblade.CalledProcessError as err:
raise exc.PackageNotFound(package) from err
path = os.path.join(path, 'launch', filename)
if not self._files.isfile(path):
raise exc.LaunchFileNotFound(path=path)
filename = os.path.join(package_path, 'launch', filename_original)
if not self._files.isfile(filename):
raise exc.LaunchFileNotFound(path=filename)
logger.debug('determined location of launch file'
f' [{filename_original}] in package [{package}]: '
f'{filename}')
Expand Down

0 comments on commit c001dfc

Please sign in to comment.