From ac19c7ebd80e1485f91e45c06b9af6657fb63d03 Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Thu, 26 Aug 2021 12:47:27 -0300 Subject: [PATCH] Do not prevent execution if the single argument is an option (#219) This prevents such kind of error: ```sh-session $ docker run jenkins/inbound-agent -disableHttpsCertValidation /usr/local/bin/jenkins-agent: 42: exec: -disableHttpsCertValidation: not found ``` Co-authored-by: Tim Jacomb --- jenkins-agent | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jenkins-agent b/jenkins-agent index 006ccca3..5a086071 100644 --- a/jenkins-agent +++ b/jenkins-agent @@ -37,9 +37,9 @@ # the agent skips connecting to an HTTP(S) port for connection info. # * JENKINS_PROTOCOLS: Specify the remoting protocols to attempt when instanceIdentity is provided. -if [ $# -eq 1 ]; then +if [ $# -eq 1 ] && [ "${1#-}" == "$1" ] ; then - # if `docker run` only has one arguments, we assume user is running alternate command like `bash` to inspect the image + # if `docker run` only has one arguments and it is not an option as `-help`, we assume user is running alternate command like `bash` to inspect the image exec "$@" else