Skip to content

Commit

Permalink
[PATCH] Allow the use of multiple arguments (jenkinsci#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil authored and lemeurherve committed Jan 15, 2022
1 parent 51e3e21 commit 2262709
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions jenkins-agent
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
#!/usr/bin/env bash

# The MIT License
#
Expand Down Expand Up @@ -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 ] && [ "${1#-}" = "$1" ] ; then
if [ "${1:0:1}" != '-' ]; then

# 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
# if `docker run`'s first argument does not look like a flag, we assume the user is running an alternate command like `bash` to inspect the image
exec "$@"

else
Expand Down

0 comments on commit 2262709

Please sign in to comment.