Bläddra i källkod

Cleaned up log output. Update launch scripts.

Because we chdir to door binary, if we don't have the
full path to the dropfile, the path needs to be updated.
Steve Thielemann 3 år sedan
förälder
incheckning
48b23310ab
3 ändrade filer med 14 tillägg och 5 borttagningar
  1. 8 4
      door/door.go
  2. 3 0
      go_4044
  3. 3 1
      run_4044

+ 8 - 4
door/door.go

@@ -231,7 +231,6 @@ func (d *Door) detect() {
 	}
 
 	// get screen size
-	var err error
 
 	pos := strings.LastIndex(results, "\x1b")
 	if pos != -1 {
@@ -242,7 +241,7 @@ func (d *Door) detect() {
 			pos = strings.Index(results, ";")
 			if pos != -1 {
 				height := results[:pos]
-				Height, err = strconv.Atoi(height)
+				Height, _ = strconv.Atoi(height)
 				pos++
 				results = results[pos:]
 
@@ -250,8 +249,8 @@ func (d *Door) detect() {
 				if pos != -1 {
 					width := results[:pos]
 
-					Width, err = strconv.Atoi(width)
-					log.Printf("Width: %s, %d, %v\n", results, Width, err)
+					Width, _ = strconv.Atoi(width)
+					// log.Printf("Width: %s, %d, %v\n", results, Width, err)
 				}
 			} else {
 				Height = 0
@@ -281,6 +280,8 @@ func (d *Door) Init(doorname string) {
 	}
 
 	d.ReadDropfile(dropfile)
+
+	// doorname - node #?
 	logfilename := fmt.Sprintf("%s-%d.log", doorname, d.Config.Node)
 	logf, err := os.OpenFile(logfilename, os.O_APPEND|os.O_CREATE|os.O_RDWR, 0666)
 	if err != nil {
@@ -288,6 +289,9 @@ func (d *Door) Init(doorname string) {
 	}
 
 	log.SetOutput(logf)
+	log.SetFlags(log.Ldate | log.Ltime | log.Lshortfile)
+	// log.SetPrefix(doorname + " ")
+
 	//= log.New(logf, fmt.Sprintf("%s-%d", doorname, d.Config.Node), log.Ldate|log.Ltime|log.Lshortfile)
 	log.Printf("Loading dropfile %s\n", dropfile)
 

+ 3 - 0
go_4044

@@ -0,0 +1,3 @@
+#!/bin/bash
+
+telnet 127.0.0.1 4044

+ 3 - 1
run_4044

@@ -1,4 +1,6 @@
 #!/bin/bash
 
-./door32 4044 "testdoor/testdoor -d door32.sys"
+# We now chdir, so ../door32.sys
+
+./door32 4044 "testdoor/testdoor -d ../door32.sys"