mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Windows - fix panic and stderr
Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
parent
91f3f992f1
commit
141a83b820
2 changed files with 15 additions and 1 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
|
@ -409,6 +410,12 @@ func initPanicFile(path string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// Reset os.Stderr to the panic file (so fmt.Fprintf(os.Stderr,...) actually gets redirected)
|
||||
os.Stderr = os.NewFile(uintptr(panicFile.Fd()), "/dev/stderr")
|
||||
|
||||
// Force threads that panic to write to stderr (the panicFile handle now), otherwise it will go into the ether
|
||||
log.SetOutput(os.Stderr)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue