File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
test/reline/yamatanooroti Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -347,6 +347,13 @@ def clear_screen
347
347
348
348
def set_winch_handler ( &handler )
349
349
@old_winch_handler = Signal . trap ( 'WINCH' , &handler )
350
+ @old_cont_handler = Signal . trap ( 'CONT' ) do
351
+ @input . raw! ( intr : true ) if @input . tty?
352
+ # Rerender the screen. Note that screen size might be changed while suspended.
353
+ handler . call
354
+ end
355
+ rescue ArgumentError
356
+ # Signal.trap may raise an ArgumentError if the platform doesn't support the signal.
350
357
end
351
358
352
359
def prep
@@ -360,5 +367,6 @@ def deprep(otio)
360
367
# Disable bracketed paste
361
368
@output . write "\e [?2004l" if Reline . core . config . enable_bracketed_paste && both_tty?
362
369
Signal . trap ( 'WINCH' , @old_winch_handler ) if @old_winch_handler
370
+ Signal . trap ( 'CONT' , @old_cont_handler ) if @old_cont_handler
363
371
end
364
372
end
Original file line number Diff line number Diff line change @@ -1840,6 +1840,25 @@ def test_thread_safe
1840
1840
EOC
1841
1841
end
1842
1842
1843
+ def test_stop_continue
1844
+ pidfile = Tempfile . create ( 'pidfile' )
1845
+ rubyfile = Tempfile . create ( 'rubyfile' )
1846
+ rubyfile . write <<~RUBY
1847
+ File.write(#{ pidfile . path . inspect } , Process.pid)
1848
+ p Reline.readmultiline('>'){false}
1849
+ RUBY
1850
+ rubyfile . close
1851
+ start_terminal ( 40 , 50 , [ 'bash' ] )
1852
+ write "ruby -I#{ @pwd } /lib -rreline #{ rubyfile . path } \n "
1853
+ write "abc\n def\n hi"
1854
+ pid = pidfile . tap ( &:rewind ) . read . to_i
1855
+ Process . kill ( :STOP , pid ) unless pid . zero?
1856
+ write "fg\n "
1857
+ write "\e bg"
1858
+ close
1859
+ assert_include result . join ( "\n " ) , ">abc\n >def\n >ghi\n "
1860
+ end
1861
+
1843
1862
def write_inputrc ( content )
1844
1863
File . open ( @inputrc_file , 'w' ) do |f |
1845
1864
f . write content
You can’t perform that action at this time.
0 commit comments