emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [BUG] babel hangs executing some shell commands in session


From: Daniele Pizzolli
Subject: [O] [BUG] babel hangs executing some shell commands in session
Date: Sun, 22 Feb 2015 09:57:22 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

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
address@hidden:/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) ...
address@hidden:/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 via email to

[Prev in Thread] Current Thread [Next in Thread]