summaryrefslogtreecommitdiff
path: root/template.go
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2019-10-23 23:06:56 -0400
committerDave Henderson <dhenderson@gmail.com>2019-10-23 23:09:48 -0400
commite0840639ea94698921025301ef6c5ff0c6961feb (patch)
treeb349bef18afad24923eb686115fdf9c245de4c0b /template.go
parentcb03ef3ca03fdbdf6d7e99866c08db4250daef3e (diff)
New --exec-pipe output option
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'template.go')
-rw-r--r--template.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/template.go b/template.go
index f2a021c7..df7d604f 100644
--- a/template.go
+++ b/template.go
@@ -103,6 +103,11 @@ func gatherTemplates(o *Config, outFileNamer func(string) (string, error)) (temp
return nil, err
}
+ // --exec-pipe redirects standard out to the out pipe
+ if o.Out != nil {
+ Stdout = &nopWCloser{o.Out}
+ }
+
switch {
// the arg-provided input string gets a special name
case o.Input != "":
@@ -336,3 +341,12 @@ func allWhitespace(p []byte) bool {
}
return true
}
+
+// like ioutil.NopCloser(), except for io.WriteClosers...
+type nopWCloser struct {
+ io.Writer
+}
+
+func (n *nopWCloser) Close() error {
+ return nil
+}