remove the tmp file
This commit is contained in:
parent
3acf473792
commit
4523eda0fa
13
init.go
13
init.go
|
@ -157,12 +157,15 @@ func initPlugin() {
|
||||||
}
|
}
|
||||||
// todo: make this a tmp file that goes away
|
// todo: make this a tmp file that goes away
|
||||||
if !me.stdout.disable {
|
if !me.stdout.disable {
|
||||||
log.Log(INFO, "stdout.disable == true. writing to /tmp/captureMode.log")
|
tmpFile, err := os.CreateTemp("", "gocui-*.log")
|
||||||
me.outf, err = os.OpenFile("/tmp/captureMode.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Info("error opening file:", err)
|
fmt.Println("Error creating temp file:", err)
|
||||||
os.Exit(0)
|
standardExit()
|
||||||
}
|
}
|
||||||
|
// defer os.Remove(tmpFile.Name())
|
||||||
|
|
||||||
|
log.Log(INFO, "stdout.disable == true. writing to", tmpFile.Name())
|
||||||
|
me.outf = tmpFile
|
||||||
// todo: some early output still goes to the /tmp/ file
|
// todo: some early output still goes to the /tmp/ file
|
||||||
//time.Sleep(200 * time.Millisecond)
|
//time.Sleep(200 * time.Millisecond)
|
||||||
log.CaptureMode(me.stdout)
|
log.CaptureMode(me.stdout)
|
||||||
|
@ -289,6 +292,7 @@ func standardExit() {
|
||||||
if me.outf != nil {
|
if me.outf != nil {
|
||||||
log.Log(NOW, "standardExit() doing outf.Close()")
|
log.Log(NOW, "standardExit() doing outf.Close()")
|
||||||
me.outf.Close()
|
me.outf.Close()
|
||||||
|
os.Remove(me.outf.Name())
|
||||||
}
|
}
|
||||||
// log(true, "standardExit() setOutput(os.Stdout)")
|
// log(true, "standardExit() setOutput(os.Stdout)")
|
||||||
// setOutput(os.Stdout)
|
// setOutput(os.Stdout)
|
||||||
|
@ -305,6 +309,7 @@ func standardClose() {
|
||||||
me.baseGui.Close()
|
me.baseGui.Close()
|
||||||
log.Log(NOW, "standardExit() doing outf.Close()")
|
log.Log(NOW, "standardExit() doing outf.Close()")
|
||||||
me.outf.Close()
|
me.outf.Close()
|
||||||
|
os.Remove(me.outf.Name())
|
||||||
// os.Stdin = os.Stdin
|
// os.Stdin = os.Stdin
|
||||||
// os.Stdout = os.Stdout
|
// os.Stdout = os.Stdout
|
||||||
// os.Stderr = os.Stderr
|
// os.Stderr = os.Stderr
|
||||||
|
|
Loading…
Reference in New Issue