From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Buggy output in bash session Date: Tue, 5 Mar 2019 13:34:04 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000c6e96505835d1e11" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:54773) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1EtQ-0007Et-Ep for emacs-orgmode@gnu.org; Tue, 05 Mar 2019 13:34:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h1EtP-0005NZ-2l for emacs-orgmode@gnu.org; Tue, 05 Mar 2019 13:34:20 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:46525) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h1EtM-0005DU-Ps for emacs-orgmode@gnu.org; Tue, 05 Mar 2019 13:34:17 -0500 Received: by mail-wr1-x434.google.com with SMTP id i16so10577204wrs.13 for ; Tue, 05 Mar 2019 10:34:16 -0800 (PST) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Steven Tilley Cc: org-mode-email --000000000000c6e96505835d1e11 Content-Type: text/plain; charset="UTF-8" I can't help with a solution, but I can at least confirm I see the same behavior! John ----------------------------------- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu On Tue, Mar 5, 2019 at 10:00 AM Steven Tilley wrote: > Hi everyone, > > First off, thanks for the great tool, and thanks to anyone who takes the > time to read this. > > This is sort of a followup on my previous email, but I was wondering if > anybody uses org-babel with bash in session mode? I've found it to be > pretty buggy for all but simple tasks, and I was wondering if I'm doing > something wrong. My googling hasn't lead to many hits, so I suspect that > might be the case. The previous email (below) is just one example, but > generally I've had problems when using multiline commands (e.g. loops, > declaring functions, etc). > > Thanks > Steve > > On Wed, Feb 27, 2019, at 4:48 PM, Steven Tilley wrote: > > Hello, > > > > I posted this on stackoverflow [1], and they suggested I post it here. > > Any help would be greatly appreciated. > > > > I've noticed in org-babel when using a bash session with multiline > > statements (e.g. a for loop), the output contains extra characters > > (specifically ">"s and the prompt. The output can also change > > throughout the session. An example is below. I found this link, which > > is probably related, but I'm not sure. I'm relatively new to emacs/org, > > so digging into the internals is a little beyond me at this point. > > Thanks! > > > > No session -> correct output > > > > #+BEGIN_SRC bash :results output > > for i in 1 2 3 > > do > > echo $i > > done > > #+END_SRC > > > > #+RESULTS: > > : 1 > > : 2 > > : 3 > > > > Session -> Incorrect output > > > > #+BEGIN_SRC bash :session test_session :results output > > for i in 1 2 3 > > do > > echo $i > > done > > #+END_SRC > > > > #+RESULTS: > > : > > : > > > 1 > > : 2 > > : 3 > > > > Running the same command in the same session, and the output changes > > > > #+BEGIN_SRC bash :session test_session :results output > > for i in 1 2 3 > > do > > echo $i > > done > > #+END_SRC > > > > #+RESULTS: > > : > > : > > 1 > > : 2 > > : 3 > > > > New session, but loop is all one one line -> incorrect output > > > > #+BEGIN_SRC bash :session test_session2 :results output > > for i in 1 2 3; do echo $i; done > > #+END_SRC > > > > #+RESULTS: > > : > > : 1 > > : 2 > > : 3 > > > > Thanks > > Steve > > > > > > [1] > > > https://stackoverflow.com/questions/54909018/org-babel-bash-output-with-sessions > > > > > > --000000000000c6e96505835d1e11 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I can't help with a solution, but I can at least confi= rm I see the same behavior!=C2=A0

John

-----------------------------------=
Professor John Kitchin=C2=A0
Doherty Hall A207F
Department of Che= mical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
= 412-268-7803


Hi everyone,

First off, thanks for the great tool, and thanks to anyone who takes the ti= me to read this.

This is sort of a followup on my previous email, but I was wondering if any= body uses org-babel with bash in session mode? I've found it to be pret= ty buggy for all but simple tasks, and I was wondering if I'm doing som= ething wrong. My googling hasn't lead to many hits, so I suspect that m= ight be the case. The previous email (below) is just one example, but gener= ally I've had problems when using multiline commands (e.g. loops, decla= ring functions, etc).

Thanks
Steve

On Wed, Feb 27, 2019, at 4:48 PM, Steven Tilley wrote:
> Hello,
>
> I posted this on stackoverflow [1], and they suggested I post it here.=
> Any help would be greatly appreciated.
>
> I've noticed in org-babel when using a bash session with multiline=
> statements (e.g. a for loop), the output contains extra characters > (specifically ">"s and the prompt. The output can also ch= ange
> throughout the session. An example is below. I found this link, which =
> is probably related, but I'm not sure. I'm relatively new to e= macs/org,
> so digging into the internals is a little beyond me at this point. > Thanks!
>
> No session -> correct output
>
> #+BEGIN_SRC bash :results output
> for i in 1 2 3
> do
>=C2=A0 =C2=A0 echo $i
> done
> #+END_SRC
>
> #+RESULTS:
> : 1
> : 2
> : 3
>
> Session -> Incorrect output
>
> #+BEGIN_SRC bash :session test_session :results output
> for i in 1 2 3
> do
>=C2=A0 =C2=A0 echo $i
> done
> #+END_SRC
>
> #+RESULTS:
> :
> : > > > 1
> : 2
> : 3
>
> Running the same command in the same session, and the output changes >
> #+BEGIN_SRC bash :session test_session :results output
> for i in 1 2 3
> do
>=C2=A0 =C2=A0 echo $i
> done
> #+END_SRC
>
> #+RESULTS:
> :
> : > > 1
> : 2
> : 3
>
> New session, but loop is all one one line -> incorrect output
>
> #+BEGIN_SRC bash :session test_session2 :results output
> for i in 1 2 3; do echo $i; done
> #+END_SRC
>
> #+RESULTS:
> :
> : 1
> : 2
> : 3
>
> Thanks
> Steve
>
>
> [1]
> https://stackov= erflow.com/questions/54909018/org-babel-bash-output-with-sessions
>
>

--000000000000c6e96505835d1e11--