Skip to content

Instantly share code, notes, and snippets.

@akerouanton
Last active February 1, 2016 09:21
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akerouanton/1b20c4d2aa11b3836de8 to your computer and use it in GitHub Desktop.
Save akerouanton/1b20c4d2aa11b3836de8 to your computer and use it in GitHub Desktop.
Bash macro preventing composer execution with xdebug enabled
COMPOSER_PATH=`which composer`
composer() {
if ! php5query -s cli -m xdebug >/dev/null; then
$COMPOSER_PATH $@
return
fi
# Re-enable xdebug even after a ctrl-c (SIGINT)
# and clear the signal handler
trap 'sudo php5enmod xdebug; trap - INT' INT
sudo php5dismod -s cli xdebug
$COMPOSER_PATH $@
sudo php5enmod -s cli xdebug
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment