Skip to content

Commit

Permalink
[FIXED] Issue with chaining commands with dlf
Browse files Browse the repository at this point in the history
  • Loading branch information
xtreme-shane-lattanzio committed Mar 30, 2022
1 parent 01d3cd3 commit a6af8c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ $ dlf "bundle install && license_finder"

You can better understand the way this script works by looking at its source, but for
reference it will mount your current directory at the path `/scan` and run any commands
passed to it from that directory.
passed to it from that directory. If your command has `&&`, ensure you quote the command.
If it does not, ensure the command is not quoted.

Note that the docker image will run the gem which is installed within it.
So the docker image tagged `7.0.0` will run *License Finder Version 7.0.0*
Expand Down
7 changes: 6 additions & 1 deletion dlf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ if `which docker > /dev/null`; then
for p in "$@"; do
escaped_params="$escaped_params \"$p\""
done
docker run -v $PWD:/scan -it licensefinder/license_finder /bin/bash -lc "cd /scan && $escaped_params"
if [[ $escaped_params =~ "&&" ]]; then
command=${escaped_params:2:${#escaped_params}-3}
else
command=$escaped_params
fi
docker run -v $PWD:/scan -it licensefinder/license_finder /bin/bash -lc "cd /scan && $command"
fi
else
echo "You do not have docker installed. Please install it:"
Expand Down

0 comments on commit a6af8c3

Please sign in to comment.