emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Buggy output in bash session
@ 2019-02-27 21:47 Steven Tilley
  2019-03-05 15:00 ` Steven Tilley
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Tilley @ 2019-02-27 21:47 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Buggy output in bash session
  2019-02-27 21:47 Buggy output in bash session Steven Tilley
@ 2019-03-05 15:00 ` Steven Tilley
  2019-03-05 18:34   ` John Kitchin
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Tilley @ 2019-03-05 15:00 UTC (permalink / raw)
  To: emacs-orgmode

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
> 
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Buggy output in bash session
  2019-03-05 15:00 ` Steven Tilley
@ 2019-03-05 18:34   ` John Kitchin
  0 siblings, 0 replies; 3+ messages in thread
From: John Kitchin @ 2019-03-05 18:34 UTC (permalink / raw)
  To: Steven Tilley; +Cc: org-mode-email

[-- Attachment #1: Type: text/plain, Size: 2667 bytes --]

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 <steve@steventilley.com>
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
> >
> >
>
>

[-- Attachment #2: Type: text/html, Size: 3955 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-05 18:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-27 21:47 Buggy output in bash session Steven Tilley
2019-03-05 15:00 ` Steven Tilley
2019-03-05 18:34   ` John Kitchin

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).