Skip to content

Commit 2d13cc5

Browse files
authored
Fixed stdin EOF while running docker container. (garrettjoecox#18)
1 parent 1ab37ff commit 2d13cc5

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

compose.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@ services:
33
image: ghcr.io/garrettjoecox/anchor:latest # remote contianer
44
#build: . # local dockerfile
55
ports:
6-
- "43383:43383"
6+
- "43383:43383"
7+
volumes:
8+
- ./stats.json:/app/stats.json #stats.json file

main.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bufio"
55
"bytes"
66
"fmt"
7+
"io"
78
"log"
89
"os"
910
"os/signal"
@@ -91,6 +92,11 @@ func processStdin(s *Server) {
9192
input, err := reader.ReadString('\n')
9293

9394
if err != nil {
95+
if err == io.EOF {
96+
log.Println("Got an EOF from stdin. Closing console gorutine.")
97+
return
98+
}
99+
94100
log.Println("Error reading from stdin:", err)
95101
continue
96102
}

0 commit comments

Comments
 (0)