Commit 8e3559c3 authored by Chris Bednarski's avatar Chris Bednarski

Guard against uninitialized pointers in io.Copy to fix #2416

parent c614bb70
......@@ -85,8 +85,13 @@ func (c *Communicator) Start(rc *packer.RemoteCmd) error {
func runCommand(shell *winrm.Shell, cmd *winrm.Command, rc *packer.RemoteCmd) {
defer shell.Close()
go io.Copy(rc.Stdout, cmd.Stdout)
go io.Copy(rc.Stderr, cmd.Stderr)
if rc.Stdout != nil && cmd.Stdout != nil {
go io.Copy(rc.Stdout, cmd.Stdout)
}
if rc.Stderr != nil && cmd.Stderr != nil {
go io.Copy(rc.Stderr, cmd.Stderr)
}
cmd.Wait()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment