Skip to content

HBASE-30370 Shell exits on errors other than NameError and SyntaxError - #8629

Open
junegunn wants to merge 1 commit into
apache:masterfrom
junegunn:HBASE-30370
Open

HBASE-30370 Shell exits on errors other than NameError and SyntaxError#8629
junegunn wants to merge 1 commit into
apache:masterfrom
junegunn:HBASE-30370

Conversation

@junegunn

@junegunn junegunn commented Sep 8, 2026

Copy link
Copy Markdown
Member

Jira: HBASE-30370

HBASE-26741 made eval_input re-raise every exception to set an exit code, which also ended interactive sessions. Worked around since for NameError (HBASE-26880) and SyntaxError (HBASE-27726); every other error still killed the prompt.

Re-raise only when the exit code is used: a script run, or -n. Everything else falls through to handle_exception, as before HBASE-26741.

A script given as an argument runs with interactive still true, so detect it by the FileInputMethod that HBaseLoader.file_for_load returns rather than by @interactive alone.

@junegunn
junegunn requested a lite review from Copilot September 8, 2026 12:10
@junegunn junegunn self-assigned this Sep 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Pull request overview

Adjusts HBase Shell IRB error handling so interactive sessions no longer exit on most runtime errors, while scripted/non-interactive runs still abort to set an appropriate process exit code (HBASE-30370).

Changes:

  • Introduces an @exit_on_error flag to conditionally re-raise exceptions only for scripts / non-interactive runs.
  • Simplifies exception handling in eval_input by removing special-cases for NameError/SyntaxError in favor of unified behavior.
  • Adds regression tests verifying interactive sessions continue after errors and file-based script runs still abort.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
hbase-shell/src/test/ruby/shell/general_test_cluster.rb Adds tests covering interactive-vs-script error behavior; introduces Tempfile usage for script simulation.
hbase-shell/src/main/ruby/irb/hirb.rb Implements conditional re-raise via @exit_on_error to prevent killing interactive sessions on runtime errors.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread hbase-shell/src/main/ruby/irb/hirb.rb Outdated
Comment thread hbase-shell/src/main/ruby/irb/hirb.rb Outdated
Comment thread hbase-shell/src/test/ruby/shell/general_test_cluster.rb Outdated
Comment thread hbase-shell/src/test/ruby/shell/general_test_cluster.rb
HBASE-26741 made eval_input re-raise every exception to set an exit code,
which also ended interactive sessions. Worked around since for NameError
(HBASE-26880) and SyntaxError (HBASE-27726); every other error still killed
the prompt.

Re-raise only when the exit code is used: a script run, or -n. Everything
else falls through to handle_exception, as before HBASE-26741.

A script given as an argument runs with interactive still true, so detect it
by the FileInputMethod that HBaseLoader.file_for_load returns rather than by
@Interactive alone.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants