* [BUG] babel hangs executing some shell commands in session
@ 2015-02-22 8:57 Daniele Pizzolli
0 siblings, 0 replies; only message in thread
From: Daniele Pizzolli @ 2015-02-22 8:57 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-02-22 8:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-22 8:57 [BUG] babel hangs executing some shell commands in session Daniele Pizzolli
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.