emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Matt <matt@excalamus.com>
To: "Suhail Singh" <suhailsingh247@gmail.com>
Cc: "Org mailing list" <emacs-orgmode@gnu.org>
Subject: Re: ob-shell: async support in "shell" vs "bash"
Date: Sun, 16 Jun 2024 20:32:01 +0200	[thread overview]
Message-ID: <19022520f63.acdaef901507354.6362811776086159414@excalamus.com> (raw)
In-Reply-To: <87h6e134sp.fsf@gmail.com>

 ---- On Mon, 10 Jun 2024 04:33:26 +0200  Suhail Singh  wrote --- 
 > On my system both "shell" and "bash" language blocks use "bash"

 > However, the value of org-babel-header-args:lang differs:
 > 
 >     #+begin_src emacs-lisp :results value replace verbatim
 >       org-babel-header-args:shell
 >     #+end_src
 > 
 >     #+RESULTS:
 >     : ((async (yes no)))
 > 
 >     #+begin_src emacs-lisp :results value replace verbatim
 >       org-babel-header-args:bash
 >     #+end_src
 > 
 >     #+RESULTS:
 >     : nil
 > 
 > Is this a bug, or are async blocks only currently allowed in "shell"
 > language blocks and not "bash" language blocks?

Thank you for your message!

:async should work for all shell types.  Are you finding that it's not?

In practice, anything but a "no" or "none" for :async should work (see "org-babel-comint-use-async").  For example, the following should run the block asynchronously:

#+begin_src bash :session *my-bash* :async banana
echo "hi"
sleep 3
echo "bye"
#+end_src

All shell languages use the "explicit-shell-file-name" to define a comint buffer using the "shell" command.  For "shell" blocks, Babel uses whatever the user has set for "explicit-shell-file-name", most likely "shell-file-name" which defaults to /bin/sh.  Many systems symlink /bin/sh to bash for interactive shells.  I suspect this is what's happening on your system.  You can check this with something like 'ls -la' or 'readlink $(which sh)'.

For all other shell languages, "explicit-shell-file-name" gets set to the block language name, literally, when "org-babel-shell-initialize" is called, such as when ob-shell is first loaded.  That word, such as "bash", will resolve according to, I believe, "exec-path" (which is basically PATH).

Regarding org-babel-header-args, "org-babel-header-args:shell" is explicitly set to '((async . ((yes no)))), it seems, to quiet the linter (https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=40d1352b).  For other languages, such as "org-babel-header-args:bash", it's set to nil.  AFAICT, what you see are simply the default values.

I'm curious, what caused you to notice this inconsistency?

--
Matt Trzcinski
Emacs Org contributor (ob-shell)
Learn more about Org mode at https://orgmode.org
Support Org development at https://liberapay.com/org-mode




  reply	other threads:[~2024-06-16 18:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-10  2:33 ob-shell: async support in "shell" vs "bash" Suhail Singh
2024-06-16 18:32 ` Matt [this message]
2024-06-16 22:02   ` Suhail Singh
2024-06-17 15:36     ` Ihor Radchenko

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=19022520f63.acdaef901507354.6362811776086159414@excalamus.com \
    --to=matt@excalamus.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=suhailsingh247@gmail.com \
    /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).