Hello
I am running Linux with kernel 6.6.47 and am running emacs in xterm, using the -nw command line argument.
When following the example, I added the suspend-resume-hook to my .emacs.d/init.el file. When I run M-: (suspend-emacs "pwd") it does not show the current working directory. But when I do fg from the terminal that I got into, I see the "Resumed!" message.
The stuff_char function is using ioctl with TIOCSTI. TIOCSTI requires CAP_SYS_ADMIN capability. You can set this capability using sysctl setting dev.tty.legacy_tiocsti to 1.
Unless I had set "dev.tty.legacy_tiocsti" to 1 I could not run the suspend-emacs command with an argument string.
Either emacs can check the return value of ioctl in stuff_char and if there return value is EPERM, then handle this accordingly, with a message regarding the problem.
Or the information relating to the kernel version and CAP_SYS_ADMIN can be added to the infor page os suspend_emacs, along with the information on how to set this capability using sysctl.
Kind Regards
Riza Dindir