From f387fe7e65ff0d358c6809baa928e6a2df660ae5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ram=C3=B3n=20Hern=C3=A1n=20Roche=20Quintana?= Date: Fri, 23 Nov 2018 09:55:44 -0800 Subject: [PATCH] sitl_run.sh handle spaces in paths launch script for jmavsim failed to start if there were any spaces in paths, string handling in paths was improved and tested. --- Tools/sitl_run.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Tools/sitl_run.sh b/Tools/sitl_run.sh index 83e7d1706c..885213b8cd 100755 --- a/Tools/sitl_run.sh +++ b/Tools/sitl_run.sh @@ -56,8 +56,8 @@ pkill -x gazebo || true pkill -x px4 || true pkill -x px4_$model || true -cp $src_path/Tools/posix_lldbinit $rootfs/.lldbinit -cp $src_path/Tools/posix.gdbinit $rootfs/.gdbinit +cp "$src_path/Tools/posix_lldbinit" "$rootfs/.lldbinit" +cp "$src_path/Tools/posix.gdbinit" "$rootfs/.gdbinit" shift 6 for file in "$@"; do @@ -69,7 +69,7 @@ SIM_PID=0 if [ "$program" == "jmavsim" ] && [ ! -n "$no_sim" ] then # Start Java simulator - $src_path/Tools/jmavsim_run.sh -r 500 & + "$src_path"/Tools/jmavsim_run.sh -r 500 & SIM_PID=`echo $!` elif [ "$program" == "gazebo" ] && [ ! -n "$no_sim" ] then @@ -78,9 +78,9 @@ then if [[ -z "$DONT_RUN" ]] then # Set the plugin path so Gazebo finds our model and sim - source $src_path/Tools/setup_gazebo.bash ${src_path} ${build_path} + source "$src_path/Tools/setup_gazebo.bash" "${src_path}" "${build_path}" - gzserver --verbose ${src_path}/Tools/sitl_gazebo/worlds/${model}.world & + gzserver --verbose "${src_path}/Tools/sitl_gazebo/worlds/${model}.world" & SIM_PID=`echo $!` if [[ -n "$HEADLESS" ]]; then @@ -105,9 +105,9 @@ pushd "$rootfs" >/dev/null set +e if [[ ${model} == test_* ]] || [[ ${model} == *_generated ]]; then - sitl_command="$sitl_bin $no_pxh $src_path/ROMFS/px4fmu_test -s ${src_path}/posix-configs/SITL/init/test/${model} -t $src_path/test_data" + sitl_command="\"$sitl_bin\" $no_pxh \"$src_path\"/ROMFS/px4fmu_test -s \"${src_path}\"/posix-configs/SITL/init/test/${model} -t \"$src_path\"/test_data" else - sitl_command="$sitl_bin $no_pxh $src_path/ROMFS/px4fmu_common -s etc/init.d-posix/rcS -t $src_path/test_data" + sitl_command="\"$sitl_bin\" $no_pxh \"$src_path\"/ROMFS/px4fmu_common -s etc/init.d-posix/rcS -t \"$src_path\"/test_data" fi echo SITL COMMAND: $sitl_command