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

bug: batch export should wait for pandoc #6

Open
pank opened this issue Nov 29, 2021 · 5 comments
Open

bug: batch export should wait for pandoc #6

pank opened this issue Nov 29, 2021 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@pank
Copy link

pank commented Nov 29, 2021

Hi,

Consider this example

$ cat test.org 
# #+title: test
# * sec
# foobar
$ emacs --batch --no-init-file --eval "(progn (package-initialize) (require 'ox-pandoc))" --file test.org --funcall org-pandoc-export-to-docx
# Running pandoc with args: (-f org -t docx -o test.docx --standalone test.tmpj1jYwb.org)
$ ls | grep docx
# empty; nothing has been exported

pandoc is called via start-process (i.e. asyncroniously). So Emacs isn't waiting for it and the process gets killed immediately because Emacs is done. So Emacs needs to wait for process to end.

$ emacs --batch --no-init-file --eval "(progn (package-initialize) (require 'ox-pandoc))" --file test.org --funcall org-pandoc-export-to-docx --eval "(sleep-for 10)"
# Running pandoc with args: (-f org -t docx -o test.docx --standalone test.tmpm4tPHW.org)
# Exported to test.docx.
$ ls |grep docx
# test.docx

I guess an easy fix would be to call pandoc "syncroniously" when noninteractive is non-nil. Otherwise, it should check that the process is done.

Thanks,
Rasmus

@a-fent a-fent self-assigned this Nov 30, 2021
@a-fent a-fent added the enhancement New feature or request label Nov 30, 2021
@a-fent
Copy link
Collaborator

a-fent commented Nov 30, 2021

Thank you for the report. For other reasons I already wanted to add synchronous processing without tempfiles (write from a buffer to pandoc on its STDIN and possibly read from its STDOUT), and was going to make this an customisation option.

@pank
Copy link
Author

pank commented Nov 30, 2021

Aside: typically org saves temp files (used for e.g. async export) in a temporary folder (e.g. /tmp on GNU/Linux) which might be a bit elegant than saving the temp file in the same folder as the "proper" file.

@minyez
Copy link

minyez commented Jul 22, 2024

Hi @a-fent , I am having the same issue for batch export. While the sleep-for workaround from @pank works for me, it would be really appreciated to have the synchronous process of running pandoc. I am also wondering if there is a way in Emacs to check whether its async processes have finished. If so, it would be better than sleep-for IMHO. Thank you.

@yantar92
Copy link
Member

yantar92 commented Jul 23, 2024 via email

@minyez
Copy link

minyez commented Jul 23, 2024

@yantar92 Thank you very much for reply. I made some modifications to address this issue and also #8 , which seems to work for me. I will submit a PR soon for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

4 participants