Skip to content

Commit d662157

Browse files
committed
Store error when failing to create a raw socket
1 parent 28c320e commit d662157

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tui/models/bisturi_model.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ func (m *bisturiModel) updateStartMenuSelection(msg tea.Msg) (tea.Model, tea.Cmd
151151
// SYS_SOCKET syscall
152152
rs, err := sockets.NewRawSocket(msg.name, msg.ethType)
153153
if err != nil {
154+
m.err = err
154155
return m, tea.Quit
155156
}
156157

@@ -175,8 +176,11 @@ func (m *bisturiModel) updateRowsInput(msg tea.Msg) (tea.Model, tea.Cmd) {
175176

176177
switch msg := msg.(type) {
177178
case tea.KeyMsg:
178-
switch msg.Type {
179-
case tea.KeyEnter:
179+
switch msg.String() {
180+
case "q", "esc", "ctrl+c":
181+
return m, tea.Quit
182+
183+
case "enter":
180184
maxRows, err := strconv.Atoi(m.rowsInput.Value())
181185
if err == nil && maxRows > 0 {
182186
m.packetsTable = newPacketsTable(maxRows)

0 commit comments

Comments
 (0)