From bbc3f688af7c23b263c459fed989a31dd435b498 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Tue, 19 Dec 2006 15:09:56 +0000 Subject: [PATCH] re-adding as a binary file git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@1382 71c3de6d-444a-0410-be80-ed276b4c234a --- war/resources/WEB-INF/slave | 51 +++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 war/resources/WEB-INF/slave diff --git a/war/resources/WEB-INF/slave b/war/resources/WEB-INF/slave new file mode 100644 index 0000000000..a40cfd5e58 --- /dev/null +++ b/war/resources/WEB-INF/slave @@ -0,0 +1,51 @@ +#!/bin/sh +# Usage: slave ... -- ... +# +# This wrapper is used to launch a process remotely with some environment variables +# set. + +# if there's any environment entries read them +if [ -f $HOME/.hudson_slave_profile ]; +then + . $HOME/.hudson_slave_profile +fi + +# set the current directory +cd "$1" +shift + +# fill in environment variables +while [ $# -gt 1 -a "$1" != "--" ]; +do + eval $1="$2" + export $1 + shift 2 +done + +if [ "$1" != "--" ]; +then + echo Error: no command given + exit -1 +fi + +shift + +# execute. use eval so that variables can be expanded now +# this allows users to specify $HOME or $DISPLAY or anything else, +# and it works as expected. +# +# but since eval mess up with whitespace ('eval ls "a b"' means the same as 'eval ls a b') +# we need to re-escape arguments (we need to say 'eval ls \"a b\"' to achieve the desired effect) +list="" +for a in "$@" +do + list="$list \"$a\"" +done +eval "$list" +ret=$? +# these additional hooks seem to prevent "select: bad filer number" error +# on some systems, so use this as a precaution. We can afford to waste +# one second, can't we? +sleep 1 +echo +exit $ret -- GitLab