From: Daniele Pizzolli <dan@toel.it>
To: emacs-orgmode@gnu.org
Subject: [BUG] babel hangs executing some shell commands in session
Date: Sun, 22 Feb 2015 09:57:22 +0100 [thread overview]
Message-ID: <86sidyiarx.fsf@me.localhost.invalid> (raw)
Hello,
I am going to give an interactive presentation of git using org-mode
and babel. But I am stuck with random hangs when executing the code
with =C-c C-c= and during export.
I am using Org-mode version 8.2.4 (8.2.4-dist @
/home/vagrant/.emacs.d/el-get/org-mode/lisp/)
The hangs does not always happen, but if you execute the following
code blocks a couple of times you should ran into the problem.
Assumption: the file =/etc/sudoers= contains something like "vagrant
ALL=(ALL) NOPASSWD:ALL" to not ask password with an interactive prompt.
#+PROPERTY: header-args:shell :session *git-shell* :dir /vagrant
#+PROPERTY: header-args:shell+ :exports both :results output verbatim replace
#+PROPERTY: header-args:shell+ :tangle git_demo.sh :shebang "#!/bin/bash" :comments org
#+BEGIN_SRC shell
sudo apt-get remove --purge --yes git && sudo apt-get autoremove --yes
#+END_SRC
#+BEGIN_SRC shell
sudo apt-get install --yes git
#+END_SRC
My guess, by looking at the *git-shell* buffer after waiting a minute
and hitting C-g, is that the output of echo 'org_babel_sh_eoe' sometimes
is eaten by some ansi sequence of the interactive command. See for
example the following cut and paste from the *git-shell* buffer. Do
babel do something nasty with the shell/term emulator?
#+begin_example
vagrant@git-pratical:/vagrant$ sudo apt-get remove --purge --yes git && sudo apt-get autoremove --yes
Reading package lists... 0%echo 'org_babel_sh_eoe'
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
git-man liberror-perl
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
git*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 22.2 MB disk space will be freed.
(Reading database ... 122644 files and directories currently installed.)
Removing git (1:2.3.0-0ppa1~ubuntu12.04.1) ...
Purging configuration files for git (1:2.3.0-0ppa1~ubuntu12.04.1) ...
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
git-man liberror-perl
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
After this operation, 1,477 kB disk space will be freed.
(Reading database ... 122040 files and directories currently installed.)
Removing git-man (1:2.3.0-0ppa1~ubuntu12.04.1) ...
Removing liberror-perl (0.17-1.1) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
vagrant@git-pratical:/vagrant$
#+end_example
An indirect confirmation of my guess comes from a test: redirecting
the output of the command and then printing it. Using this workaround
babel never hangs:
#+BEGIN_SRC shell
(any_strange_command) 1>/tmp/1 2>/tmp/2; cat /tmp/1 /tmp/2
#+END_SRC
Do you think that is easy to fix babel or can you suggest a less
invasive and more comprehensive workaround? Wrapping loops and pipes is
going to clutter the code to the point that is better to use a script
with inline comments rather that using the org-mode buffer.
Thanks in advance,
Daniele
reply other threads:[~2015-02-22 8:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86sidyiarx.fsf@me.localhost.invalid \
--to=dan@toel.it \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).