Skip to content

Commit 6bf84d6

Browse files
authored
Merge pull request #100 from ekohl/fix-ruby-3.4
Reflect Ruby 3.4 stack trace changes
2 parents b35bea4 + 4da6fc2 commit 6bf84d6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/puppet/util.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,11 @@ def thinmark
523523

524524
module_function :thinmark
525525

526-
PUPPET_STACK_INSERTION_FRAME = /.*puppet_stack\.rb.*in.*`stack'/
526+
PUPPET_STACK_INSERTION_FRAME = if RUBY_VERSION >= '3.4'
527+
/.*puppet_stack\.rb.*in.*'Puppet::Pops::PuppetStack\.stack'/
528+
else
529+
/.*puppet_stack\.rb.*in.*`stack'/
530+
end
527531

528532
# utility method to get the current call stack and format it to a human-readable string (which some IDEs/editors
529533
# will recognize as links to the line numbers in the trace)

spec/unit/util/logging_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ def run(exception_class)
455455
expect(log.message).to_not match('/logging_spec.rb')
456456
expect(log.backtrace[0]).to match('/logging_spec.rb')
457457

458-
expect(log.backtrace.any? { |l| l =~ /\/tmp\/test2\.pp:20/ }).to be true
458+
expect(log.backtrace).to include(/\/tmp\/test2\.pp:20/)
459459
puppetstack = log.backtrace.select { |l| l =~ /tmp\/test\d\.pp/ }
460460

461461
expect(puppetstack.length).to eq(3)

0 commit comments

Comments
 (0)