reddit / emacs

org-babel shell session hangs with gdb

1nc0ns1st3nt · 2022-06-16 11:12
I have a shell session in a org file opened, which has started `gdb` in it. I am having trouble to execute any gdb commands in shell source blocks as it would hang, I have to use `C-g` to interrupt the evaluation, however, in the session buffer file the outputs are all shown once interrupted. Is there any work arounds for this? Thanks in advance!
1nc0ns1st3nt · 2022-06-16 11:14
I would also be interested in writing my own org-babel package for this, however, as I knew few on this topic, if someone could advise me on that, it would be also very helpful! Thanks
yantar92 · 2022-06-18 10:21
I assume that you are using shell code blocks (#+begin_src bash). They are not tailored to cater interactive commands. You may need to write a dedicated ob-interactive.el or something. The starting point is ob-comint.el, which contains common routines to work with M-x shell
1nc0ns1st3nt · 2022-06-18 20:50
Yes, I am using `#+begin_src shell` actually. And thanks for the tip of ob-comint, I took the execute functions in `ob-shell` and rewrote parts of `org-babel-sh-evaluate` as `org-babel-gdb-evaluate` to make it work!