File tree Expand file tree Collapse file tree 4 files changed +11
-2
lines changed Expand file tree Collapse file tree 4 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package main
3
3
import (
4
4
"strings"
5
5
6
+ "github.com/lima-vm/lima/pkg/debugutil"
6
7
"github.com/lima-vm/lima/pkg/version"
7
8
"github.com/sirupsen/logrus"
8
9
"github.com/spf13/cobra"
@@ -25,6 +26,7 @@ func newApp() *cobra.Command {
25
26
debug , _ := cmd .Flags ().GetBool ("debug" )
26
27
if debug {
27
28
logrus .SetLevel (logrus .DebugLevel )
29
+ debugutil .Debug = true
28
30
}
29
31
return nil
30
32
}
Original file line number Diff line number Diff line change 8
8
"runtime"
9
9
"strings"
10
10
11
+ "github.com/lima-vm/lima/pkg/debugutil"
11
12
"github.com/lima-vm/lima/pkg/fsutil"
12
13
"github.com/lima-vm/lima/pkg/osutil"
13
14
"github.com/lima-vm/lima/pkg/store/dirnames"
@@ -94,6 +95,7 @@ func newApp() *cobra.Command {
94
95
debug , _ := cmd .Flags ().GetBool ("debug" )
95
96
if debug {
96
97
logrus .SetLevel (logrus .DebugLevel )
98
+ debugutil .Debug = true
97
99
}
98
100
99
101
if osutil .IsBeingRosettaTranslated () && cmd .Parent ().Name () != "completion" && cmd .Name () != "generate-doc" && cmd .Name () != "validate" {
Original file line number Diff line number Diff line change
1
+ package debugutil
2
+
3
+ // Debug is set via main.
4
+ var Debug bool
Original file line number Diff line number Diff line change 8
8
"path/filepath"
9
9
"runtime"
10
10
11
+ "github.com/lima-vm/lima/pkg/debugutil"
11
12
"github.com/lima-vm/lima/pkg/limayaml"
12
13
"github.com/sirupsen/logrus"
13
14
)
@@ -50,14 +51,14 @@ func Dir() (string, error) {
50
51
filepath .Join (selfDirDir , "share/lima/lima-guestagent." + ostype + "-" + arch ),
51
52
// TODO: support custom path
52
53
}
53
- if logrus . GetLevel () == logrus . DebugLevel {
54
+ if debugutil . Debug {
54
55
// candidate 2: lauched by `~/go/bin/dlv dap`
55
56
// - self: ${workspaceFolder}/cmd/limactl/__debug_bin_XXXXXX
56
57
// - agent: ${workspaceFolder}/_output/share/lima/lima-guestagent.Linux-x86_64
57
58
// - dir: ${workspaceFolder}/_output/share/lima
58
59
candidateForDebugBuild := filepath .Join (filepath .Dir (selfDirDir ), "_output/share/lima/lima-guestagent." + ostype + "-" + arch )
59
60
gaCandidates = append (gaCandidates , candidateForDebugBuild )
60
- logrus .Infof ("debug build detected, adding more guest agent candidates: %v" , candidateForDebugBuild )
61
+ logrus .Infof ("debug mode detected, adding more guest agent candidates: %v" , candidateForDebugBuild )
61
62
}
62
63
for _ , gaCandidate := range gaCandidates {
63
64
if _ , err := os .Stat (gaCandidate ); err == nil {
You can’t perform that action at this time.
0 commit comments