Skip to content

Commit

Permalink
fix(bin): Resolve the potential symlink to the bash script (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 authored Feb 21, 2023
1 parent 00e2646 commit d68cbf1
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions bin/eask
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,19 @@
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.

BASEDIR=$(dirname "$0")
node "$BASEDIR/../eask" "$@"
function _get_current_directory()
{
if dirname "$(readlink -f "${0}")" &>/dev/null
then
CDIR="$(cd "$(dirname "$(readlink -f "${0}")")" && pwd)"
elif realpath -e -L "${0}" &>/dev/null
then
CDIR="$(realpath -e -L "${0}")"
CDIR="${CDIR%/eask}"
fi
}

CDIR="$(pwd)"
_get_current_directory

node "$CDIR/../eask" "$@"

0 comments on commit d68cbf1

Please sign in to comment.