Fix issue with shell closing on failed docker-env call
This commit is contained in:
parent
047235b341
commit
1493035702
@ -162,17 +162,6 @@ function see() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function docker-env() {
|
function docker-env() {
|
||||||
function usage() {
|
|
||||||
cat >&2 <<EOS
|
|
||||||
Usage: docker-env [OPTIONS] [--] IMAGE [COMMAND] [ARG...]
|
|
||||||
|
|
||||||
Options:
|
|
||||||
-p <port> Publish a container's port(s) to the host
|
|
||||||
-v <volume> Bind mount a volume
|
|
||||||
EOS
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
port=
|
port=
|
||||||
workdir=/work_dir
|
workdir=/work_dir
|
||||||
volumes=("$(pwd):/work_dir")
|
volumes=("$(pwd):/work_dir")
|
||||||
@ -185,13 +174,17 @@ EOS
|
|||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
-p)
|
-p)
|
||||||
port=$2
|
port="$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-v)
|
-v)
|
||||||
volumes+=("$2")
|
volumes+=("$2")
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
-w)
|
||||||
|
workdir="$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
@ -199,14 +192,21 @@ EOS
|
|||||||
|
|
||||||
if [ $# -eq 0 ]
|
if [ $# -eq 0 ]
|
||||||
then
|
then
|
||||||
usage
|
break
|
||||||
fi
|
fi
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $# -eq 0 ]
|
if [ $# -eq 0 ]
|
||||||
then
|
then
|
||||||
usage
|
cat >&2 <<EOS
|
||||||
|
Usage: docker-env [OPTIONS] [--] IMAGE [COMMAND] [ARG...]
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-p <port> Publish a container's port(s) to the host
|
||||||
|
-v <volume> Bind mount a volume
|
||||||
|
EOS
|
||||||
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
image="$1"
|
image="$1"
|
||||||
@ -228,7 +228,7 @@ EOS
|
|||||||
run_command+=" -v $volume"
|
run_command+=" -v $volume"
|
||||||
done
|
done
|
||||||
|
|
||||||
run_command+=" $image $cmd"
|
run_command+=" -w \"$workdir\" $image $cmd"
|
||||||
|
|
||||||
eval $run_command
|
eval $run_command
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user