cmd/cli: check root privilege for log commands

This commit is contained in:
Cuong Manh Le
2025-01-15 23:14:18 +07:00
committed by Cuong Manh Le
parent 4df470b869
commit e9e63b0983

View File

@@ -37,6 +37,9 @@ func initLogCmd() *cobra.Command {
Use: "send",
Short: "Send runtime debug logs to ControlD",
Args: cobra.NoArgs,
PreRun: func(cmd *cobra.Command, args []string) {
checkHasElevatedPrivilege()
},
Run: func(cmd *cobra.Command, args []string) {
dir, err := socketDir()
if err != nil {
@@ -74,6 +77,9 @@ func initLogCmd() *cobra.Command {
Use: "view",
Short: "View current runtime debug logs",
Args: cobra.NoArgs,
PreRun: func(cmd *cobra.Command, args []string) {
checkHasElevatedPrivilege()
},
Run: func(cmd *cobra.Command, args []string) {
dir, err := socketDir()
if err != nil {