mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
main: not reopen /dev/stderr
commit a146081828 introduced a change to
write to /dev/stderr by default. Do not reopen the file in this case,
but use directly the fd 2.
Closes: https://github.com/opencontainers/runc/issues/2056
Closes: https://github.com/kubernetes/kubernetes/issues/77615
Closes: https://github.com/cri-o/cri-o/issues/2368
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@@ -87,7 +87,7 @@ func main() {
|
|||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "log",
|
Name: "log",
|
||||||
Value: "/dev/stderr",
|
Value: "",
|
||||||
Usage: "set the log file path where internal debug information is written",
|
Usage: "set the log file path where internal debug information is written",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
@@ -157,9 +157,15 @@ func (f *FatalWriter) Write(p []byte) (n int, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createLogConfig(context *cli.Context) logs.Config {
|
func createLogConfig(context *cli.Context) logs.Config {
|
||||||
|
logFilePath := context.GlobalString("log")
|
||||||
|
logPipeFd := ""
|
||||||
|
if logFilePath == "" {
|
||||||
|
logPipeFd = "2"
|
||||||
|
}
|
||||||
config := logs.Config{
|
config := logs.Config{
|
||||||
|
LogPipeFd: logPipeFd,
|
||||||
LogLevel: logrus.InfoLevel,
|
LogLevel: logrus.InfoLevel,
|
||||||
LogFilePath: context.GlobalString("log"),
|
LogFilePath: logFilePath,
|
||||||
LogFormat: context.GlobalString("log-format"),
|
LogFormat: context.GlobalString("log-format"),
|
||||||
}
|
}
|
||||||
if context.GlobalBool("debug") {
|
if context.GlobalBool("debug") {
|
||||||
|
|||||||
Reference in New Issue
Block a user