Pause on console in libmisc/shell detecting terminal size (mvme5500, beatnik)

Peter Dufault dufault at hda.com
Fri Jan 5 18:36:46 UTC 2024



> On Jan 4, 2024, at 8:01 PM, Joel Sherrill <joel at rtems.org> wrote:
> 
> 
> Commit 7260887fa989c0141e7265cd851e00b4101410d8 "Work around tmux bug in 
> row and column" introduced 150ms timeout(usleep(1000) 150 times). I 
> tested On my board, the exact delay is about 300ms.  Timeout (in process 
> shell command) will be called 3times, so the whole delay is about 1s.
> 
> So maybe 150ms seems a bit long.
> 
> But I found usleep() always sleep 1 more millisecond. usleep(1000) 
> actual delay is about 2000us, usleep(1000000) actual delay is about 
> 1001000us. rtems_task_wake_after() is exact.
> 
> Sounds like some math is arbitrarily adding a tick in the conversion to ticks. It should just be a matter of following the code in a desk check and checking the math. Could need a modulo to only add an extra tick when there is a remainder.
> 

I "#if 0"d out the call to "rtems_shell_term_row_column_swapped()" that checks for a broken "tmux" terminal.  That is what sends "\033[>0q" to the console.  I no longer see "0q" on the console but there is still a long pause before the command is executed.

Does it make sense to check the shell's terminal for its size before executing every command?  It could be checked once, or the check could be moved into its own command.  Now the shell checks for the terminal size and if it is a "tmux" terminal before it calls every command.

The escape sequence does work on gnome-terminal, so I'm not sure what causes the delay. I can investigate that, but question if this
should be done in the shell.

[dufault at gen6 rtems]$ echo -e "\e[18t"
^[[8;42;111t
[dufault at gen6 rtems]$ 

Peter
-----------------
Peter Dufault
HD Associates, Inc.      Software and System Engineering





More information about the devel mailing list