diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2019-10-23 23:06:56 -0400 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2019-10-23 23:09:48 -0400 |
| commit | e0840639ea94698921025301ef6c5ff0c6961feb (patch) | |
| tree | b349bef18afad24923eb686115fdf9c245de4c0b /template.go | |
| parent | cb03ef3ca03fdbdf6d7e99866c08db4250daef3e (diff) | |
New --exec-pipe output option
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'template.go')
| -rw-r--r-- | template.go | 14 |
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 +} |
