Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: return err if there is no answer #63

Merged
merged 4 commits into from
Jul 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: return err if there is no answer
  • Loading branch information
gescheit committed Jul 18, 2024
commit ef4f43deebc6b8636444e3c2bda7eff8575bc5a2
12 changes: 7 additions & 5 deletions pkg/device/genericcli/genericcli.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,15 +552,17 @@ func GenericExecute(command cmd.Cmd, connector streamer.Connector, cli GenericCL
return nil, fmt.Errorf("QuestionHandler error %w", err)
}
if len(answer) > 0 {
logger.Debug("auto answer to question")
err := connector.Write(answer)
if err != nil {
return nil, fmt.Errorf("write error %w", err)
}
}
logger.Debug("auto answer to question")
err = connector.Write([]byte("\n"))
if err != nil {
return nil, fmt.Errorf("write error %w", err)
err = connector.Write([]byte("\n"))
if err != nil {
return nil, fmt.Errorf("write error %w", err)
}
} else {
return nil, fmt.Errorf("not found answer for '%s'", question)
}
} else if matchName == "cb" { // ExprCallback
if cbLimit == 0 { // reset cbLimit in other cases
Expand Down
Loading