Using less in environment without controlling tty

Rich Felker dalias at aerifal.cx
Wed Jul 31 19:35:02 UTC 2013


On Tue, Jul 30, 2013 at 05:43:23AM +0200, Harald Becker wrote:
> >I just tried this:
> >
> >setsid sh -c 'exec </dev/tty12 >/dev/tty12 2>&1; exec less FILE'
> >
> >and it worked (both setsid and less are bbox applets here).
> 
> May be it worked for you, but here you setsid before exec of the
> shell. The shell is execed directly after fork. This would mean
> limiting possibilities of console_buffer. ... and anything else
> is just to much workaround for a simple request, the possibility
> to specify the output terminal, not using fixed /dev/tty, not
> output on ctty.
> 
> In addition the new session directs signal to the viewer
> process , that is less not the controlling master process. As
> required.
> 
> Argh ... and now I see it: "less FILE" ... you are going to
> display a file ... I'm piping data from my calling program (and
> there is no location to save this data).

Then try:

cmd | setsid sh -c 'exec >/dev/tty12 2>&1 ; exec less'

Rich


More information about the busybox mailing list