summaryrefslogtreecommitdiff
path: root/user/gitlab-runner/posix-shell.patch
blob: 6169c3ecc14a7df6c776bd43a396ee0eab540afe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
--- gitlab-runner-v12.1.0/shells/bash.go	2019-07-19 12:13:32.000000000 +0000
+++ gitlab-runner-v12.1.0/shells/bash.go	2020-04-26 23:07:57.303304498 +0000
@@ -102,12 +102,12 @@ func (b *BashWriter) Variable(variable c
 }
 
 func (b *BashWriter) IfDirectory(path string) {
-	b.Line(fmt.Sprintf("if [[ -d %q ]]; then", path))
+	b.Line(fmt.Sprintf("if [ -d %q ]; then", path))
 	b.Indent()
 }
 
 func (b *BashWriter) IfFile(path string) {
-	b.Line(fmt.Sprintf("if [[ -e %q ]]; then", path))
+	b.Line(fmt.Sprintf("if [ -e %q ]; then", path))
 	b.Indent()
 }
 
@@ -200,9 +200,10 @@ func (b *BashWriter) Finish(trace bool)
 		io.WriteString(w, "set -o xtrace\n")
 	}
 
-	io.WriteString(w, "set -eo pipefail\n")
+	io.WriteString(w, "set -e\n")
 	io.WriteString(w, "set +o noclobber\n")
-	io.WriteString(w, ": | eval "+helpers.ShellEscape(b.String())+"\n")
+	io.WriteString(w, "(\nexec </dev/null\n")
+	io.WriteString(w, b.String() + "\n)\n")
 	io.WriteString(w, "exit 0\n")
 	w.Flush()
 	return buffer.String()