Skip to content
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

Allow any script to be executed anywhere inside the repo #444

Merged
merged 3 commits into from
Aug 14, 2023

Conversation

era
Copy link
Contributor

@era era commented Aug 10, 2023

I noticed most tests were doing cd "$(git rev-parse --show-toplevel)/trustfall_testbin", except those that receive paths as parameters. My guess is those scripts were not doing that because the user may give relative paths and changing the directory will break user assumptions about it.

For those scripts, I transform any path the user set as arguments into an absolute path, so we can safely move directories.

I tested this by passing absolute paths and relative paths on Linux.

@era era marked this pull request as ready for review August 10, 2023 16:33
for INPUT_FILE in "$@"; do
# makes sure we are always using absolute path
INPUT_FILES+=("$(cd "$(dirname "$1")"; pwd)/$(basename "$1")")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice trick, I'll have to remember that! 💯

@obi1kenobi obi1kenobi merged commit 42e7c5c into obi1kenobi:main Aug 14, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants