Skip to content

Commit

Permalink
Store error when failing to create a raw socket
Browse files Browse the repository at this point in the history
  • Loading branch information
NamelessOne91 committed Jul 11, 2024
1 parent 389366b commit 06a0940
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tui/models/bisturi_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ func (m *bisturiModel) updateStartMenuSelection(msg tea.Msg) (tea.Model, tea.Cmd
// SYS_SOCKET syscall
rs, err := sockets.NewRawSocket(msg.name, msg.ethType)
if err != nil {
m.err = err
return m, tea.Quit
}

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

switch msg := msg.(type) {
case tea.KeyMsg:
switch msg.Type {
case tea.KeyEnter:
switch msg.String() {
case "q", "esc", "ctrl+c":
return m, tea.Quit

case "enter":
maxRows, err := strconv.Atoi(m.rowsInput.Value())
if err == nil && maxRows > 0 {
m.packetsTable = newPacketsTable(maxRows)
Expand Down

0 comments on commit 06a0940

Please sign in to comment.