Skip to content

Commit

Permalink
Revert ruby#335 (Trap TSTP to handle C-z)
Browse files Browse the repository at this point in the history
This PR was an effort to address ruby#321 (ed_quoted_insert doesn't work
properly) but per the reporter it did not work correctly.

Moreover, it introduced a major regression: Shell job control stopped
working in all applications that use reline, notably IRB.

Bash and other shells send SIGTSTP in response to C-z to implement job
suspension. Handling SIGSTP opts out of this functionality. For a
line oriented terminal program this should be avoided (not to mention,
this behavior diverges from readline's)
  • Loading branch information
brasic committed Apr 24, 2023
1 parent 43283b2 commit 05201bb
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions lib/reline/line_editor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -239,21 +239,10 @@ def set_signal_handlers
@old_trap.call if @old_trap.respond_to?(:call)
end
}
begin
@old_tstp_trap = Signal.trap('TSTP') {
Reline::IOGate.ungetc("\C-z".ord)
@old_tstp_trap.call if @old_tstp_trap.respond_to?(:call)
}
rescue ArgumentError
end
end

def finalize
Signal.trap('INT', @old_trap)
begin
Signal.trap('TSTP', @old_tstp_trap)
rescue ArgumentError
end
end

def eof?
Expand Down

0 comments on commit 05201bb

Please sign in to comment.