mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Add client_flush to flush output when transient commands are called.
This commit is contained in:
		
							
								
								
									
										27
									
								
								client.c
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								client.c
									
									
									
									
									
								
							@@ -1,4 +1,4 @@
 | 
			
		||||
/* $Id: client.c,v 1.7 2007-09-27 20:53:13 nicm Exp $ */
 | 
			
		||||
/* $Id: client.c,v 1.8 2007-09-28 19:04:21 nicm Exp $ */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
 | 
			
		||||
@@ -124,6 +124,31 @@ retry:
 | 
			
		||||
	return (0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
client_flush(struct client_ctx *cctx)
 | 
			
		||||
{
 | 
			
		||||
	struct pollfd	 pfd;
 | 
			
		||||
 | 
			
		||||
	/* XXX error response! */
 | 
			
		||||
	while (BUFFER_USED(cctx->srv_out) > 0) {
 | 
			
		||||
		pfd.fd = cctx->srv_fd;
 | 
			
		||||
		pfd.events = POLLIN|POLLOUT;
 | 
			
		||||
	
 | 
			
		||||
		if (poll(&pfd, 1, INFTIM) == -1) {
 | 
			
		||||
			if (errno == EAGAIN || errno == EINTR)
 | 
			
		||||
				continue;
 | 
			
		||||
			fatal("poll failed");
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (buffer_poll(&pfd, cctx->srv_in, cctx->srv_out) != 0) {
 | 
			
		||||
			log_warnx("lost server");
 | 
			
		||||
			return (1);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return (0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int
 | 
			
		||||
client_main(struct client_ctx *cctx)
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user