fix: log debug output when commands fail - #77
rupayon123 wants to merge 8 commits into
Conversation
|
Hi!! Sorry for the delay. Im reviewing now |
| rescue RubyShell::CommandError => e | ||
| time_two = Process.clock_gettime(Process::CLOCK_MONOTONIC) | ||
| log_command(command, time_two - time_one, e.status, e.stdout, e.stderr) | ||
| raise |
There was a problem hiding this comment.
In some situations on the past, i had some troubles with errors losing data when rescued.
This actual code will not give us problems, but. Lets add a test checking that when we have a command being rescued outside, with debug option true, the returned CommandError has the correct attributes. Like:
begin
ls('error', _debug: true)
rescue => e
puts e.command # => Correct command
puts e.stdout # => Correct stdout
# etc
end|
Nice! Now, check the cicd, there is some failures |
| end | ||
|
|
||
| it "logs failed command stdout before reraising" do | ||
| run_failed_debug_command |
There was a problem hiding this comment.
We can separate the run_failed_debug_command on before blocks and distinct contexts, instead create a method to execute the code. To follow the idiomatic idea of rspec
|
@rupayon123 there are still some failures, can you check? |
|
Fixed the two RuboCop offenses from the last run in 0f35634: added the missing final newline in Both edited files pass The new Ruby CI run requires maintainer approval before it can execute. Could you approve it so we can verify the full suite and RuboCop on Ruby 3.2.2? |
|
Follow-up for This morning's attempt to post the validation note failed through the connector; this is the first posted update for that commit. Local Ruby syntax and focused smoke checks pass. Full RSpec remains unverified locally because this environment lacks the project's current Bundler/debug tooling. The new CI runs 34486079934 and 34486079865 await maintainer approval. I also found a separate Ruby 2.6 operator-routing failure and submitted it independently in #78, keeping that patch out of this debug-error PR. Prepared with AI assistance. |
Fixes #73
Debug mode now logs the command details before re-raising
RubyShell::CommandError, so failed commands still show what ran. I also included stderr in the debug output, as requested in the issue thread.Checks:
ruby -c lib/rubyshell/debugger.rbruby -c lib/rubyshell/error.rbruby -c spec/debugger_spec.rbruby -IlibI could not run the full RSpec file locally because the
rspecexecutable is not installed here.