fix rosrun, and use uniq to remove spurious choices
This commit is contained in:
parent
dca458d575
commit
66de7deee1
|
@ -181,7 +181,7 @@ function _roscmd {
|
|||
echo "Couldn't find package [$1]"
|
||||
return 1
|
||||
fi
|
||||
exepath=(`find -L $catkin_source_dir $catkin_binary_dir $pkgdir -name $2 -type f ! -regex .*/[.].* ! -regex .*$pkgdir\/build\/.*`)
|
||||
exepath=(`find -L $catkin_source_dir $catkin_binary_dir $pkgdir -name $2 -type f ! -regex .*/[.].* ! -regex .*$pkgdir\/build\/.* | uniq`)
|
||||
if [[ ${#exepath[@]} == 0 ]] ; then
|
||||
echo "That file does not exist in that package."
|
||||
return 1
|
||||
|
|
|
@ -6,11 +6,23 @@ if [ $# -lt 2 ]; then
|
|||
echo " If it finds it, it will run it with ARGS."
|
||||
exit 1
|
||||
fi
|
||||
pkgdir=`rospack find $1` || exit 2
|
||||
if [[ -n $CATKIN_SOURCE_DIR ]]; then
|
||||
catkin_source_dir=`ROS_ROOT=$CATKIN_SOURCE_DIR ROS_PACKAGE_PATH= rospack find $1`
|
||||
fi
|
||||
if [[ -n $CATKIN_BINARY_DIR && -f $CATKIN_BINARY_DIR/etc/packages.list ]]; then
|
||||
cbd=`grep $1 $CATKIN_BINARY_DIR/etc/packages.list | cut -d " " -f 2`
|
||||
if [[ -n $cbd ]]; then
|
||||
catkin_binary_dir=$CATKIN_BINARY_DIR/$cbd
|
||||
fi
|
||||
fi
|
||||
pkgdir=`rospack find $1`
|
||||
if [[ -z $catkin_source_dir && -z $catkin_binary_dir && -z $pkgdir ]]; then
|
||||
return 2
|
||||
fi
|
||||
# The -perm /mode usage is not available in find on the Mac
|
||||
#exepathlist=(`find $pkgdir -name $2 -type f -perm /u+x,g+x,o+x`)
|
||||
# -L: #3475
|
||||
exepathlist=(`find -L $pkgdir -name $2 -type f -perm +111 ! -regex ".*$pkgdir\/build\/.*"`)
|
||||
exepathlist=(`find -L $catkin_source_dir $catkin_binary_dir $pkgdir -name $2 -type f -perm +111 ! -regex ".*$pkgdir\/build\/.*" | uniq`)
|
||||
if [[ ${#exepathlist[@]} == 0 ]] ; then
|
||||
echo "[rosrun] Couldn't find executable named $2 below $pkgdir"
|
||||
nonexepathlist=(`find -H $pkgdir -name $2`)
|
||||
|
|
Loading…
Reference in New Issue