mirror of https://github.com/Hilbis/Hilbish
fix(revert): feat: write errors and panics to tmp log file
This reverts commit 1e1b9d07b0
.
why did i even do this in the first place
pull/59/head
parent
1e1b9d07b0
commit
83a44954cd
20
main.go
20
main.go
|
@ -4,11 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
dbg "runtime/debug"
|
|
||||||
"strings"
|
"strings"
|
||||||
"strconv"
|
|
||||||
"syscall"
|
|
||||||
"io/ioutil"
|
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"os/user"
|
"os/user"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
@ -22,10 +18,9 @@ import (
|
||||||
"golang.org/x/term"
|
"golang.org/x/term"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var version = "v0.4.1-dev.9"
|
||||||
version = "v0.4.1-dev.9"
|
|
||||||
debug = "false"
|
|
||||||
|
|
||||||
|
var (
|
||||||
l *lua.LState
|
l *lua.LState
|
||||||
|
|
||||||
prompt string // User's prompt, this will get set when lua side is initialized
|
prompt string // User's prompt, this will get set when lua side is initialized
|
||||||
|
@ -62,18 +57,7 @@ func main() {
|
||||||
loginshflag := getopt.Lookup('l').Seen()
|
loginshflag := getopt.Lookup('l').Seen()
|
||||||
interactiveflag := getopt.Lookup('i').Seen()
|
interactiveflag := getopt.Lookup('i').Seen()
|
||||||
noexecflag := getopt.Lookup('n').Seen()
|
noexecflag := getopt.Lookup('n').Seen()
|
||||||
debugbool, _ := strconv.ParseBool(debug)
|
|
||||||
|
|
||||||
if debugbool {
|
|
||||||
tmpfile, _ := ioutil.TempFile("", "hilbish*.log")
|
|
||||||
|
|
||||||
// redirects stderr to our tmpfile
|
|
||||||
// this is for logging panics
|
|
||||||
err := syscall.Dup2(int(tmpfile.Fd()), int(os.Stderr.Fd()))
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("Failed to redirect stderr to file: %v", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if *cmdflag == "" || interactiveflag {
|
if *cmdflag == "" || interactiveflag {
|
||||||
interactive = true
|
interactive = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue