Skip to content

measure does not measure when an exception occurs #533

Closed

Description

@elfham

Description

measure does not seem to work when an exception occurs.

Steps to Reproduce

I want to measure the timeout of Regexp.

Expected

$ irb
irb(main):001:0> measure
TIME is added.
=> nil
irb(main):002:0> Regexp.compile('^a*b?a*()\1$', timeout: 10.0) =~ "a" * 50000 + "x"
processing time: 61.212516s
=> nil
irb(main):003:0> Regexp.new('^a*b?a*()\1$', timeout: 10.0) =~ "a" * 50000 + "x"
processing time: 10.000240s
(irb):3:in `<main>': regexp match timeout (Regexp::TimeoutError)
        from /home/elfham/test/reline/irb/exe/irb:9:in `<main>'
irb(main):004:0>

Actual

$ irb
irb(main):001:0> measure
TIME is added.
=> nil
irb(main):002:0> Regexp.compile('^a*b?a*()\1$', timeout: 10.0) =~ "a" * 50000 + "x"
processing time: 61.212516s
=> nil
irb(main):003:0> Regexp.new('^a*b?a*()\1$', timeout: 10.0) =~ "a" * 50000 + "x"
(irb):3:in `<main>': regexp match timeout (Regexp::TimeoutError)
        from /home/elfham/test/reline/irb/exe/irb:9:in `<main>'
irb(main):004:0>

Result of irb_info

irb(main):001:0> irb_info
=>
Ruby version: 3.2.1
IRB version: irb 1.6.2 (2022-12-13)
InputMethod: RelineInputMethod with Reline 0.3.2
RUBY_PLATFORM: x86_64-freebsd13.1
East Asian Ambiguous Width: 1

Terminal Emulator

PuTTYrv 0.78-ranvis2 (CJK)

Setting Files

No ~/.irbrc or ~/.inputrc.

Activity

  1. added
    bug
    on May 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions