Github user agozhiy commented on a diff in the pull request: https://github.com/apache/drill/pull/1210#discussion_r183683315 --- Diff: distribution/src/resources/runbit --- @@ -65,6 +65,47 @@ drill_rotate_log () fi } +args=( $@ ) +RBARGS=() +for (( i=0; i < ${#args[@]}; i++ )); do + case "${args[i]}" in + --debug*) + DEBUG=true + DEBUG_STRING=`expr "${args[i]}" : '.*:\(.*\)'` + ;; + *) RBARGS+=("${args[i]}");; + esac +done + +# Enables remote debug if requested +# Usage: --debug:[parameter1=value,parameter2=value] +# Optional parameters: +# port=[port_number] - debug port number +# suspend=[y/n] - pause until the IDE connects + +if [ $DEBUG ]; then + debug_params=( $(echo $DEBUG_STRING | grep -o '[^,"]*') ) + for param in ${debug_params[@]}; do + case $param in + port*) + DEBUG_PORT=`expr "$param" : '.*=\(.*\)'` + ;; + suspend*) + DEBUG_SUSPEND=`expr "$param" : '.*=\(.*\)'` + ;; + esac + done + + if [ -z $DEBUG_PORT ]; then + DEBUG_PORT=50000 + fi + if [ -z $DEBUG_SUSPEND ]; then + DEBUG_SUSPEND='n' + fi + + JAVA_DEBUG="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=$DEBUG_PORT,server=y,suspend=$DEBUG_SUSPEND" +fi --- End diff -- Done.
---