mirror of
https://github.com/kemko/nomad.git
synced 2026-01-07 10:55:42 +03:00
avoid opening files just to close them
This commit is contained in:
@@ -177,13 +177,11 @@ func (c *ExecCommand) Stderr() (io.WriteCloser, error) {
|
||||
}
|
||||
|
||||
func (c *ExecCommand) Close() {
|
||||
stdout, err := c.Stdout()
|
||||
if err == nil {
|
||||
stdout.Close()
|
||||
if c.stdout != nil {
|
||||
c.stdout.Close()
|
||||
}
|
||||
stderr, err := c.Stderr()
|
||||
if err == nil {
|
||||
stderr.Close()
|
||||
if c.stderr != nil {
|
||||
c.stderr.Close()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user