diff --git a/cmd/run.go b/cmd/run.go index 94662f3b4..00dd626d8 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -75,6 +75,7 @@ func Run(flags *RunFlags, args []string, istty bool, writer io.Writer, testing b if flags.ShowDisks { if runtime.GOOS == "linux" { + ui.SetIgnoreDirPaths(flags.IgnoreDirs) ui.ListDevices(analyze.GetDevicesInfo) } else { fmt.Fprint(writer, "Listing devices is not yet supported for this platform") diff --git a/tui/tui.go b/tui/tui.go index a1eef8565..93e494db8 100644 --- a/tui/tui.go +++ b/tui/tui.go @@ -315,10 +315,6 @@ func (ui *UI) fileItemSelected(row, column int) { func (ui *UI) deviceItemSelected(row, column int) { selectedDevice := ui.table.GetCell(row, column).GetReference().(*analyze.Device) - if ui.ignoreDirPaths == nil { - ui.ignoreDirPaths = make(map[string]bool, 10) - } - for _, device := range ui.devices { if device.Name != selectedDevice.Name && !strings.HasPrefix(selectedDevice.MountPoint, device.MountPoint) { ui.ignoreDirPaths[device.MountPoint] = true diff --git a/tui/tui_test.go b/tui/tui_test.go index 2d8a63f8d..0366e7f22 100644 --- a/tui/tui_test.go +++ b/tui/tui_test.go @@ -320,6 +320,7 @@ func TestSelectDevice(t *testing.T) { ui := CreateUI(simScreen, true) ui.analyzer = analyzeMock + ui.SetIgnoreDirPaths([]string{"/proc"}) ui.ListDevices(getDevicesInfoMock) go func() {