Thanks. I'll check out those tools now.

On Sat, Aug 26, 2017 at 3:33 AM Jakob Borg <ja...@kastelo.net> wrote:

> I think your best bet is to open a TTY manually when you detect that
> stdout is not a tty. You can use for example
> https://github.com/mattn/go-isatty to determine this. An
> `os.Open("/dev/tty")` might be enough, otherwise a package like
> https://github.com/mattn/go-tty shows some of the setup you might need to
> do. You then give this file as the stdout file descriptor to vim.
>
> Clearly this only works on systems that have a /dev/tty, but you're
> already limited to system that have a vim so this might be fine.
>
> //jb
>
>
> > On 26 Aug 2017, at 07:58, juicemia <hugo.torres1...@gmail.com> wrote:
> >
> > Hi everybody.
> >
> > I don't know if this question has been asked before, partially because I
> don't really even know what to call what I'm trying to do.
> >
> > The best I can come up with is that I'm trying to do lazy redirection in
> bash but I'm having some trouble.
> >
> > A concrete example should help explain:
> >
> > I have a Go program. Part of this program's execution is to open up Vim
> for some editing. The user can then save and close, and the program will
> continue working using the user's input into Vim.
> >
> > That works well. However, it breaks down when I do something like the
> following:
> >
> > program | grep 'foo'
> >
> > When I do this, Vim complains about stdout not being a terminal. I
> realize this is because the pipe redirects the stdout of program to the
> stdin of grep _before_ the execution of program, not after.
> >
> > Is there any way I can get the redirection to happen _after_ program has
> executed?
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "golang-nuts" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to golang-nuts+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to