unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Yassine Chaouche <a.chaouche@algerian-radio.dz>
To: help-gnu-emacs@gnu.org
Subject: Emacs freezing when running any shell command after loading bashrc file with a specific line
Date: Wed, 11 Sep 2024 16:22:06 +0100	[thread overview]
Message-ID: <1e752995-889b-fa03-8373-178047db74af@algerian-radio.dz> (raw)
In-Reply-To: <4a3e5a99-41db-af2a-8165-9454df54ac45@algerian-radio.dz>

Dear list,

I'm turning to you in the hope to get help from users who might have experienced the same problem as I am.
It has to do with calling shell commands from emacs after loading bashrc.
To reproduce the problem:

1. Create a .bashrc_emacs file with a simple 3-lines content like this one:

# -*- shell-script -*-
export PATH="$PATH":~/SYNCHRO/bin/ # put the path to where net.ip.private is
export BOOTTIME=$(sys.boottime)


2. Create and chmod +x the sys.boottime shell script with a simple content like this one:

#!/bin/bash
last reboot | awk 'NR == 1 {print $5,$6,$7,$8}'

3. Evaluate this line of elisp code to load the bashrc_emacs file prior to executing a shell command with M-!:

(setenv "BASH_ENV" (expand-file-name "~/.bashrc_emacs"))


4. Then call any shell command, like a simple echo "hello world!"

In my case, it simply freezes.
if I replace this line in the bashrc_emacs file:

export BOOTTIME=$(sys.boottime)

with this line:

export UP=$(last reboot | awk 'NR == 1 {print $5,$6,$7,$8}')

then everything works right.
it only freezes when I use that script,
which is in the path by the way.
you can even comment that line:


# export UP=$(last reboot | awk 'NR == 1 {print $5,$6,$7,$8}')
# or
# export BOOTTIME=$(sys.boottime)

and M-! echo $BOOTTIME
which should return last time your machine booted.

Any help appreciated.
This is Emacs 24 running on linux.


Best,


-- 
yassine -- sysadm
+213-779 06 06 23
http://about.me/ychaouche
Looking for side gigs.



       reply	other threads:[~2024-09-11 15:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4a3e5a99-41db-af2a-8165-9454df54ac45@algerian-radio.dz>
2024-09-11 15:22 ` Yassine Chaouche [this message]
2024-09-12  9:32   ` Emacs freezing when running any shell command after loading bashrc file with a specific line Yassine Chaouche

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.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1e752995-889b-fa03-8373-178047db74af@algerian-radio.dz \
    --to=a.chaouche@algerian-radio.dz \
    --cc=help-gnu-emacs@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.
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).