Re: Weird issue, command output unable to pipe or capture

Link Dupont <[email protected]>
Newsgroups gmane.org.user-groups.linux.svlug
Message-ID <[email protected]>
If you set PYTHONUNBUFFERED=1 in your env before running python, it'll
turn off that output buffering.

On Thu, 2018-04-19 at 11:32 -0700, kevin dankwardt wrote:
> Caching/buffering stderr sounds pretty unfortunate and inconvenient.
> 
> On Thu, Apr 19, 2018 at 11:28 AM, Steve Litt <[email protected]
> om> wrote:
> > When using |& to pipe stderr and stdout to the same place, be
> > careful
> > not to assume anything about order in the merged stream. Python 3
> > has
> > all sorts of caching so that stderr is outputted later than you'd
> > think
> > it would be.
> > 
> > SteveT
> > 
> > 
> > On Thu, 19 Apr 2018 10:40:11 -0700
> > kevin dankwardt <[email protected]> wrote:
> > 
> > > |&  is also handy so that stdout and stderr both go into the
> > pipe.
> > > 
> > > as an example
> > > 
> > > $ strace -e open ls |& grep /lib
> > > 
> > > 
> > > 
> > > On Thu, Apr 19, 2018 at 8:53 AM, Robert Freiberger
> > > <[email protected]> wrote:
> > > 
> > > > That works!
> > > >
> > > > So I never knew that you could route the stderr after the > to
> > a
> > > > file. I'm going to refresh my knowledge of stdout and stderr
> > but I
> > > > was able to capture the output in a variable by using the
> > foo=$(foo
> > > > 2>&1). I honestly don't think I've encountered this before.
> > > >
> > > > Thanks again!
> > > >
> > > > On Wed, Apr 18, 2018 at 9:07 PM Lister <[email protected]
> > m>
> > > > wrote: 
> > > >>
> > > >>
> > > >> On 04/18/2018 09:01 PM, Robert Freiberger wrote:  
> > > >> > Hello,
> > > >> >
> > > >> > I've stumbled across a strange issue and wasn't sure if I'm
> > > >> > overlooking something very simple. The problem is at work we
> > > >> > have an application written in Ruby which is a wrapper for
> > Chef
> > > >> > knife command. It's pretty much taking the Chef environments
> > > >> > from our Chef org and building a set of arguments.
> > > >> >
> > > >> > For example:
> > > >> >
> > > >> > $ foo dev-stage1 list
> > > >> >
> > > >> > This would use the Chef knife command to query the hosts in
> > the
> > > >> > dev-stage1 environment and list them out. The problem is the
> > > >> > output does not allow me to pipe or capture in a bash
> > variable
> > > >> > "foo=$(foo dev-stage1 list)". Even something like "$ foo
> > > >> > dev-stage1 list > /tmp/foo" doesn't work either.  
> > > >> Are you sure the command does not output to stderr?
> > > >> You may try
> > > >> $ foo > /tmp/foo 2>&1
> > > >>
> > > >> thanks
> > > >> K
> > > >>  
> > > > --
> > > > Robert Freiberger
> > > > 510-936-1210
> > > >
> > > > _______________________________________________
> > > > svlug mailing list
> > > > [email protected]
> > > > http://lists.svlug.org/lists/listinfo/svlug
> > > >
> > > >  
> > > 
> > > 
> > 
> > _______________________________________________
> > svlug mailing list
> > [email protected]
> > http://lists.svlug.org/lists/listinfo/svlug
> 
> 
> 
> _______________________________________________
> svlug mailing list
> [email protected]
> http://lists.svlug.org/lists/listinfo/svlug

_______________________________________________
svlug mailing list
[email protected]
http://lists.svlug.org/lists/listinfo/svlug
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAABCAAdFiEEqa+yVxzJn+17d/PuSGi9TERQ3rwFAlrY5LwACgkQSGi9TERQ
3rxZzggAgi+piY+9HeTZNR/V1NZLxSLMaD4eG7aQRZWtAf3szlH0FouCUSyWspWz
5YrgRrRoaJRDV7USGp8HBnlNbnsvqDr9mZKNulayCMY3T+s0L2oN6QSAzQ5G8p+0
hTq2bnoVM+rktI9njwXiorJQWCguKpW4DWsRhGtw7Yi3xxEhkxIOgdGvGnZWbhKX
sW4EuKt1SzqrvV6vGsd/qxl/DTHeixXCKfFzBnP4w2vWaC8LYUQtclx6pbly9pyG
VvLVF6u/cbvXP/fS5Xt/fhhTvYCeoaXF/5tTNYPju4ZySUlDcCpU7O3cehTSY5yy
MsTvb4Eh+M5phA48ErOOkbhHIkMUZg==
=wyVP
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.