66# Grab full name of php-fpm container
77PHP_FPM_CONTAINER=$( docker-compose ps | grep php-fpm | cut -d" " -f 1)
88
9+
10+ # Grab OS type
11+ if [[ " $( uname) " == " Darwin" ]]; then
12+ OS_TYPE=" OSX"
13+ else
14+ OS_TYPE=$( expr substr $( uname -s) 1 5)
15+ fi
16+
17+
918xdebug_status ()
1019{
1120 echo ' xDebug status'
1221
1322 # If running on Windows, need to prepend with winpty :(
14- if [[ " $( expr substr $( uname -s ) 1 5 ) " == " MINGW" ]]; then
23+ if [[ $OS_TYPE == " MINGW" ]]; then
1524 winpty docker exec -it $PHP_FPM_CONTAINER bash -c ' php -v'
1625
1726 else
@@ -20,6 +29,7 @@ xdebug_status ()
2029
2130}
2231
32+
2333xdebug_start ()
2434{
2535 echo ' Start xDebug'
@@ -30,7 +40,7 @@ xdebug_start ()
3040
3141
3242 # If running on Windows, need to prepend with winpty :(
33- if [[ " $( expr substr $( uname -s ) 1 5 ) " == " MINGW" ]]; then
43+ if [[ $OS_TYPE == " MINGW" ]]; then
3444 winpty docker exec -it $PHP_FPM_CONTAINER bash -c " ${ON_CMD} "
3545 docker restart $PHP_FPM_CONTAINER
3646 winpty docker exec -it $PHP_FPM_CONTAINER bash -c ' php -v'
@@ -40,9 +50,9 @@ xdebug_start ()
4050 docker restart $PHP_FPM_CONTAINER
4151 docker exec -it $PHP_FPM_CONTAINER bash -c ' php -v'
4252 fi
43-
4453}
4554
55+
4656xdebug_stop ()
4757{
4858 echo ' Stop xDebug'
@@ -52,7 +62,7 @@ xdebug_stop ()
5262
5363
5464 # If running on Windows, need to prepend with winpty :(
55- if [[ " $( expr substr $( uname -s ) 1 5 ) " == " MINGW" ]]; then
65+ if [[ $OS_TYPE == " MINGW" ]]; then
5666 # This is the equivalent of:
5767 # winpty docker exec -it laradock_php-fpm_1 bash -c 'bla bla bla'
5868 # Thanks to @michaelarnauts at https://github.com/docker/compose/issues/593
0 commit comments