aboutsummaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-12-12 11:55:40 +0100
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-12-12 11:55:40 +0100
commit029a61282512b633d8210de9101510a8284d4923 (patch)
tree5e86ba69ef44799473b7e2e23455c0fd0caa966f /main.go
parent273743466fa39a14bf7abf73f30427406684f3d3 (diff)
Fixed Windows support.v0.2.2
Diffstat (limited to 'main.go')
-rw-r--r--main.go21
1 files changed, 14 insertions, 7 deletions
diff --git a/main.go b/main.go
index f7db365..8d9865b 100644
--- a/main.go
+++ b/main.go
@@ -58,7 +58,7 @@ var AppSubVersion = "unknown-dev"
// Create logger
var log = logrus.New()
-var logFileInitial = "/tmp/xds-gdb.log"
+var logFileInitial = path.Join(os.TempDir(), "xds-gdb.log")
// Application details
const (
@@ -100,12 +100,13 @@ func main() {
logFile = logFileInitial
fdL, err := os.OpenFile(logFileInitial, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0666)
if err != nil {
- msgErr := fmt.Sprintf("Cannot create log file %s", logFileInitial)
- exitError(syscall.EPERM, msgErr)
+ fmt.Printf("WARNING: Cannot create initial log file %s\n", logFileInitial)
+ log.Level = logrus.WarnLevel
+ } else {
+ log.Out = fdL
+ log.Level = logrus.DebugLevel
}
log.Formatter = &logrus.TextFormatter{}
- log.Out = fdL
- log.Level = logrus.DebugLevel
agentURL = "localhost:8800"
logLevel = defaultLogLevel
@@ -356,8 +357,14 @@ endloop:
log.Debugf("Recv OUT: <%s>", stdout)
}
if stderr != "" {
- fmt.Fprintf(os.Stderr, "%s", stderr)
- log.Debugf("Recv ERR: <%s>", stderr)
+ // Filter-out ugly message (python error when cross gdb exited)
+ if !strings.Contains(stderr, "readline.write_history_file") &&
+ !(strings.Contains(stderr, "Traceback") && strings.Contains(stderr, "__exithandler")) {
+ fmt.Fprintf(os.Stderr, "%s", stderr)
+ log.Debugf("Recv ERR: <%s>", stderr)
+ } else {
+ log.Debugf("Recv ERR (FILTERED OUT): <%s>", stderr)
+ }
}
// Correctly report error about init file