Skip to content
This repository was archived by the owner on May 27, 2024. It is now read-only.

Commit 3fadf86

Browse files
committed
fix daemon log not created error
1 parent 67e2e24 commit 3fadf86

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
language: go
33
sudo: false
44
go:
5-
- "1.12"
5+
- "1.13"
66
env:
77
- GO111MODULE=on
88

hub.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func (c *Client) readPump() {
175175

176176
func broadcastWebsocket() func(http.ResponseWriter, *http.Request) {
177177
hub := newHub()
178-
go hub.run()
178+
go hub.run() // start read images from unix:@minicap
179179

180180
return func(w http.ResponseWriter, r *http.Request) {
181181
conn, err := upgrader.Upgrade(w, r, nil)

main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,11 +380,16 @@ func translateMinicap(conn net.Conn, jpgC chan []byte, ctx context.Context) erro
380380
func runDaemon() (cntxt *daemon.Context) {
381381
cntxt = &daemon.Context{ // remove pid to prevent resource busy
382382
PidFilePerm: 0644,
383-
LogFileName: daemonLogPath,
384383
LogFilePerm: 0640,
385384
WorkDir: "./",
386385
Umask: 022,
387386
}
387+
// log might be no auth
388+
if f, err := os.OpenFile(daemonLogPath, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0644); err == nil {
389+
f.Close()
390+
cntxt.LogFileName = daemonLogPath
391+
}
392+
388393
child, err := cntxt.Reborn()
389394
if err != nil {
390395
log.Fatal("Unale to run: ", err)

0 commit comments

Comments
 (0)