Suspending the Linux CLI Session (workaround for no Ctrl-Z)
1 post
• Page 1 of 1
Suspending the Linux CLI Session (workaround for no Ctrl-Z)
This is just some notes for posterity (18.2):
Typically, in CLI applications on Linux such as editors or REPLs, typing Ctrl-Z will temporarily suspend the editor or REPL and drop you back into the parent shell. However, the Dyalog CLI session on Linux doesn't do this; typing Ctrl-Z directly inserts a SUB character into the session.
Under the hood, Ctrl-Z defaults to sending SIGSTP to the foreground process, so as a workaround we can do the same:
After which we can then type ⎕se.susp to get the behavior of Ctrl-Z. Note that pid_t is translated into I4 above because GNU libc specifies pid_t to be an int: https://www.gnu.org/software/libc/manua ... ation.html.
Typically, in CLI applications on Linux such as editors or REPLs, typing Ctrl-Z will temporarily suspend the editor or REPL and drop you back into the parent shell. However, the Dyalog CLI session on Linux doesn't do this; typing Ctrl-Z directly inserts a SUB character into the session.
Under the hood, Ctrl-Z defaults to sending SIGSTP to the foreground process, so as a workaround we can do the same:
- Code: Select all
'getpid' ⎕SE.getpid 'I4 libc.so.6|getpid' ⍝ pid_t getpid(void)
'kill' ⎕SE.kill 'I4 libc.so.6|kill I4 I4' ⍝ int kill(pid_t pid, int sig)
⎕SE.⎕FX 'susp;sigstp' 'getpid kill sigstp←20'
After which we can then type ⎕se.susp to get the behavior of Ctrl-Z. Note that pid_t is translated into I4 above because GNU libc specifies pid_t to be an int: https://www.gnu.org/software/libc/manua ... ation.html.
- baingeenej
- Posts: 4
- Joined: Fri May 13, 2022 9:33 am
1 post
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group