-
Notifications
You must be signed in to change notification settings - Fork 67
fix: Resolve runfiles in launch_exec templates #633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| import os | ||
| import sys | ||
| from python.runfiles import runfiles | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please insert an empty line above as this is an external dep. |
||
|
|
||
| env = os.environ.copy() | ||
|
|
||
|
|
@@ -16,5 +17,5 @@ if not ament_prefix_path: | |
| else: | ||
| env["AMENT_PREFIX_PATH"] = ament_prefix_path | ||
|
|
||
| entry_point = "{entry_point}" | ||
| entry_point = runfiles.Create().Rlocation("{entry_point}") | ||
| os.execve(entry_point, [entry_point, *sys.argv[1:]], env) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,10 +12,12 @@ if [ -n "${BAZEL_TEST:-}" ]; then | |
| fi | ||
| fi | ||
|
|
||
| ENTRYPOINT="$(rlocation {entry_point})" | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't you have to depend on a target from rules_sh for this to work? I remember that earlier versions of rules_sh required copy/pasting of a snippet. |
||
|
|
||
| ament_prefix_path="{{ament_prefix_path}}" | ||
| if [ -z "${ament_prefix_path}" ]; then | ||
| unset AMENT_PREFIX_PATH | ||
| exec {entry_point} "$@" | ||
| exec ${ENTRYPOINT} "$@" | ||
| else | ||
| AMENT_PREFIX_PATH="${ament_prefix_path}" exec {entry_point} "$@" | ||
| AMENT_PREFIX_PATH="${ament_prefix_path}" exec ${ENTRYPOINT} "$@" | ||
| fi | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that we had a bug before?