Hello Eli,
I am new to the code base, and it was just a suggestion to check for the ioctl call for any failures and take precautions, maybe inform the user of the issue that the suspend-emacs command did not run correctly. Since the command was not printing out anything when called with 'M-: (suspend-emacs "pwd")' I was not sure what was happening.
/* Should perhaps error if in batch mode */
#ifdef TIOCSTI
ioctl (fileno (CURTTY()->input), TIOCSTI, &c);
#else /* no TIOCSTI */
error ("Cannot stuff terminal input characters in this version of Unix");
#endif /* no TIOCSTI */
I have downloaded the code for emacs 29.4 and compiled it with a simple error check and the ioctl call failed on my system silently (with kernel 6.6.47).
To add a check is of course for the people who develop emacs to decide. I have seen the code today, and am not in a position to suggest anything at this stage. Maybe there would be a better way of handling this error.
Adding an error check would be one of the solutions.
The other solution might be to add a piece of information to the documentation for suspend-emacs, (and maybe to the documentation string for suspend-emacs) regarding this problem. So that people that use linux kernel 6.2+ would be aware of this issue.
The issue is fixable by just setting the dev.tty.legacy_tiocsti sysctl variable to 1. This variable was set to 0 on my system. Hence the ioctl call for TIOCSTI was failing, and no indication of the error was given. After I have read the man page for TIOCSTI, and set the sysctl variable dev.tty.legacy_tiocsti to 1 was I able to call suspend-emacs with a STUFFSTRING and it worked. It was displaying the output of the "pwd" command.
Regards
Riza