@@ -34,15 +34,12 @@ import (
34
34
"google.golang.org/grpc"
35
35
)
36
36
37
- var (
38
- daemonize bool
39
- debug bool
40
- debugFile string
41
- debugFilters []string
42
- )
43
-
44
37
// NewCommand created a new `daemon` command
45
38
func NewCommand (srv rpc.ArduinoCoreServiceServer , settings * rpc.Configuration ) * cobra.Command {
39
+ var daemonize bool
40
+ var debug bool
41
+ var debugFile string
42
+ var debugFiltersArg []string
46
43
var daemonPort string
47
44
daemonCommand := & cobra.Command {
48
45
Use : "daemon" ,
@@ -65,7 +62,7 @@ func NewCommand(srv rpc.ArduinoCoreServiceServer, settings *rpc.Configuration) *
65
62
}
66
63
},
67
64
Run : func (cmd * cobra.Command , args []string ) {
68
- runDaemonCommand (srv , daemonPort )
65
+ runDaemonCommand (srv , daemonPort , debugFile , debug , daemonize , debugFiltersArg )
69
66
},
70
67
}
71
68
defaultDaemonPort := settings .GetDaemon ().GetPort ()
@@ -82,13 +79,13 @@ func NewCommand(srv rpc.ArduinoCoreServiceServer, settings *rpc.Configuration) *
82
79
daemonCommand .Flags ().StringVar (& debugFile ,
83
80
"debug-file" , "" ,
84
81
i18n .Tr ("Append debug logging to the specified file" ))
85
- daemonCommand .Flags ().StringSliceVar (& debugFilters ,
82
+ daemonCommand .Flags ().StringSliceVar (& debugFiltersArg ,
86
83
"debug-filter" , []string {},
87
84
i18n .Tr ("Display only the provided gRPC calls" ))
88
85
return daemonCommand
89
86
}
90
87
91
- func runDaemonCommand (srv rpc.ArduinoCoreServiceServer , daemonPort string ) {
88
+ func runDaemonCommand (srv rpc.ArduinoCoreServiceServer , daemonPort , debugFile string , debug , daemonize bool , debugFiltersArg [] string ) {
92
89
logrus .Info ("Executing `arduino-cli daemon`" )
93
90
94
91
gRPCOptions := []grpc.ServerOption {}
@@ -113,6 +110,7 @@ func runDaemonCommand(srv rpc.ArduinoCoreServiceServer, daemonPort string) {
113
110
debugStdOut = out
114
111
}
115
112
}
113
+ debugFilters = debugFiltersArg
116
114
gRPCOptions = append (gRPCOptions ,
117
115
grpc .UnaryInterceptor (unaryLoggerInterceptor ),
118
116
grpc .StreamInterceptor (streamLoggerInterceptor ),
0 commit comments