Hmm maybe I'm being an idiot and it is ok, let me look at it again later. Stdin/stdout/stderr are normally all the same fd anyway of course.
On Tue, Mar 19, 2013 at 11:01:00PM -0500, Chris Johnsen wrote: > On Tue, Mar 19, 2013 at 4:19 PM, Nicholas Marriott > <nicholas.marri...@gmail.com> wrote: > > Ok thanks. My only concern is sharing the same fd for stdin and stdout - > > what happens if the copy-pipe command prints something? > > On my system (Mac OS X 10.8.3, which is supposed to be similar to > BSD systems), having the copy-pipe command write to its stdout works > okay. The output ends up in the job->event->input buffer (I checked > with some debug code in job_free that prints out the "input" buffer > if it is not empty); the data sent by copy-pipe ends up on the > command's stdin as usual. The two directions do not appear mixed or > interleaved in any way. Do you expect something different might > happen on other systems? > > My assumption is that socketpair() arranges the pair as if they had > gone through the regular process of bind/listen/accept and connect, > just without having to name one side. Thus, I expected that (even > after being duped) data written to the first could only be read form > the second, and vice versa (this appears to be what happens on my > system). > > I found a couple of instances in the portable OpenSSH code where one > side of a socketpair() is duped to both stdin and stdout, but I also > noticed that several platforms opt to use a pair of pipe()s instead > of socketpair(). Many of these systems seem "old" to me, but HP-UX > stood out as one that tmux supports (also SunOS 4?). > > The libevent docs say that bufferevent_new does not support pipe > fds, but I suppose we could use two socketpairs that have each been > shutdown to half duplex in opposite directions. > > Alternatively, copy-pipe could be implemented as a new, write-only > job variant instead of the read-write approach that this minimal > implementation ends up with. > > -- > Chris ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_mar _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users