Skip to content

Suspend not working in IRB Ruby 3.1.2 #466

Closed

Description

@sandro

Description

When I enter IRB session, I expect pressing CTRL-Z to suspend the program, but it does not. If I press <Enter> after CTRL-Z I see irb(main):002:0* ^Z

Suspend functionality works fine for me on Ruby 2.7 and Ruby 3.0.1

Terminal Emulator

What's your terminal emulator?

ZSH
iTerm2 and Terminal on Mac OS

Activity

  1. junaruga commented on Sep 7, 2022

    @junaruga
    Member

    What's your terminal emulator?

    ZSH

    I suppose that the "ZSH" is not the terminal emulator but the shell. The terminal emulator is like "terminator", "alacrity", "xterm" and etc. See https://en.wikipedia.org/wiki/List_of_terminal_emulators.

  2. sandro commented on Sep 7, 2022

    @sandro
    Author

    @junaruga my mistake, I use iTerm2 but Terminal on Mac OS is also affected.

  3. elfham commented on Sep 8, 2022

    @elfham
    Contributor

    It looks like that bug got in at #335.

  4. sandro commented on Sep 8, 2022

    @sandro
    Author

    @elfham that was a year ago. Is IRB in Ruby 3.1.2 really that old?

    I have the problem with this sample code running against reline master with Ruby 3.1.2:

      require "reline"
      prompt = "> "
    
      begin
        while true
          text = Reline.readmultiline(prompt) do |data|
            puts "in", data
          end
          puts "you entered"
          puts text
        end
      rescue Interrupt
        puts "CTRL-C"
        exit 0
      end

    Using Ctrl-Z works fine when using Ruby 3.0.1

  5. elfham commented on Sep 10, 2022

    @elfham
    Contributor

    Since this bug was introduced in #335, I believe that subsequent versions of Reline have had the problem.
    (Reline 0.2.8~, Ruby 3.1.0~)

    As I commented in #321 (comment) , I think commit #335 is inappropriate and should be reverted once.

  6. sandro commented on Sep 10, 2022

    @sandro
    Author

    @elfham Oh, my mistake, I thought you were saying the bug was fixed in #335 not that it was introduced there. Sorry for the confusion, and thanks for shedding light on this problem!

  7. casper commented on Jan 15, 2023

    @casper

    Just installed Ruby 3.2.0 and ran into this same problem (Ubuntu Linux).
    Strangely on Ruby 3.0, which also uses Reline, C-z works as expected.

  8. brasic commented on Apr 24, 2023

    @brasic
    Contributor

    I can confirm that this is still an issue in main for all ruby versions and that it's caused by #335. I use the following awkward monkeypatch in .irbrc to restore the ability to suspend irb with C-z:

    module Signal
      @real_trap = method(:trap)
      def self.trap(*args, &block)
        if args[0] != 'TSTP'
          @real_trap.call(*args, &block)
        end
      end
    end

    I've opened #535 to revert the prior PR, as I don't believe it does anything useful.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions