commit | 13653b217de6dc818b4b6ec1ec35b0a61043fee8 | [log] [tgz] |
---|---|---|
author | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | Thu May 28 22:45:12 2015 +0900 |
committer | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | Thu May 28 22:47:37 2015 +0900 |
tree | 5d5e40332e4450126d468551be3af148a34f6bc4 | |
parent | 4c3dc40c43f571b436eaf467321834676d0fb533 [diff] |
Use sub-shell for each command
diff --git a/ninja.go b/ninja.go index f982a59..57b6573 100644 --- a/ninja.go +++ b/ninja.go
@@ -132,10 +132,22 @@ if cmd == "" { cmd = "true" } + + needsSubShell := i > 0 || len(runners) > 1 + if cmd[0] == '(' { + needsSubShell = false + } + + if needsSubShell { + buf.WriteByte('(') + } buf.WriteString(cmd) if i == len(runners)-1 && r.ignoreError { buf.WriteString(" ; true") } + if needsSubShell { + buf.WriteByte(')') + } } return buf.String() }