Skip to content

Instantly share code, notes, and snippets.

@tsibley
Created June 25, 2014 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsibley/b0250a2c07339105dc30 to your computer and use it in GitHub Desktop.
Save tsibley/b0250a2c07339105dc30 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Potentially re-exec commands inside the current directory's carton
# environment.
#
# Usage: alias perldoc='maybe-via-carton perldoc'
#
cmd=$1
shift
if [[ -f cpanfile.snapshot && -d local ]] && which carton >/dev/null 2>/dev/null; then
echo running inside carton >&2
exec carton exec -- $cmd "$@"
else
exec $cmd "$@"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment