Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

View output of process before it finishes #13

Open
DvdMgr opened this issue Sep 19, 2017 · 6 comments
Open

View output of process before it finishes #13

DvdMgr opened this issue Sep 19, 2017 · 6 comments

Comments

@DvdMgr
Copy link

DvdMgr commented Sep 19, 2017

Is it possible to view the output of the process that is being executed by ob-sync while it is still running? I would like to see at which point of the execution my program is, since it prints progress on the standard output, but I've found no mention of this in the readme. As a possible approach, redirecting the output of the program to a temporary buffer would be fine!

Thanks for the great work!

@DvdMgr DvdMgr changed the title View output of process View output of process before it finishes Sep 19, 2017
@astahlman
Copy link
Owner

I'd love to have this, too. Unfortunately, I can't think of a straightforward way to implement it.

I'm actually not even sure how to do this without ob-async. I think we would first need to ensure that stdout of any subprocess launched by org-babel-execute:$lang is captured in a local buffer. Then we would have to somehow shuttle the contents of that buffer in the inferior Emacs process back to the parent process, which may involve extending emacs-async.

Maybe I'm making it harder than it needs to be - open to ideas if anyone wants to take this on.

@astahlman
Copy link
Owner

Then we would have to somehow shuttle the contents of that buffer in the inferior Emacs process back to the parent process, which may involve extending emacs-async.

Or maybe we should explore a thread-based approach (available in Emacs 26) instead of using emacs-async. See this comment for details.

@preetpalS
Copy link

@astahlman Maybe there is a simple way to do with this tee. See http://man7.org/linux/man-pages/man1/tee.1.html ; it is available on Windows as well (there might be ways to do this natively on Windows as well).

@ibizaman
Copy link

ibizaman commented Oct 2, 2018

@astahlman I was wondering did you try using set-process-filter? I'm monkey patching emacs-async to see if this can lead to somewhere. I've seen it used here https://github.com/gregsexton/ob-ipython/blob/7147455230841744fb5b95dcbe03320313a77124/ob-ipython.el#L279-L297

@astahlman
Copy link
Owner

Hey @ibizaman, I didn't try it myself but I'd be interested to hear the results of your monkey-patching experiment.

@adrianparvino
Copy link

This exists, for prior art: https://github.com/whacked/ob-shstream/blob/master/ob-shstream.el

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants