mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Add pane_dead_status for exit status of dead panes.
This commit is contained in:
		
							
								
								
									
										8
									
								
								format.c
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								format.c
									
									
									
									
									
								
							@@ -17,6 +17,7 @@
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <sys/types.h>
 | 
					#include <sys/types.h>
 | 
				
			||||||
 | 
					#include <sys/wait.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <ctype.h>
 | 
					#include <ctype.h>
 | 
				
			||||||
#include <errno.h>
 | 
					#include <errno.h>
 | 
				
			||||||
@@ -581,6 +582,7 @@ format_window_pane(struct format_tree *ft, struct window_pane *wp)
 | 
				
			|||||||
	unsigned long long	 size;
 | 
						unsigned long long	 size;
 | 
				
			||||||
	u_int			 i, idx;
 | 
						u_int			 i, idx;
 | 
				
			||||||
	char			*cmd;
 | 
						char			*cmd;
 | 
				
			||||||
 | 
						int			 status;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (ft->w == NULL)
 | 
						if (ft->w == NULL)
 | 
				
			||||||
		ft->w = wp->window;
 | 
							ft->w = wp->window;
 | 
				
			||||||
@@ -604,9 +606,13 @@ format_window_pane(struct format_tree *ft, struct window_pane *wp)
 | 
				
			|||||||
	format_add(ft, "pane_title", "%s", wp->base.title);
 | 
						format_add(ft, "pane_title", "%s", wp->base.title);
 | 
				
			||||||
	format_add(ft, "pane_id", "%%%u", wp->id);
 | 
						format_add(ft, "pane_id", "%%%u", wp->id);
 | 
				
			||||||
	format_add(ft, "pane_active", "%d", wp == wp->window->active);
 | 
						format_add(ft, "pane_active", "%d", wp == wp->window->active);
 | 
				
			||||||
	format_add(ft, "pane_dead", "%d", wp->fd == -1);
 | 
					 | 
				
			||||||
	format_add(ft, "pane_input_off", "%d", !!(wp->flags & PANE_INPUTOFF));
 | 
						format_add(ft, "pane_input_off", "%d", !!(wp->flags & PANE_INPUTOFF));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						status = wp->status;
 | 
				
			||||||
 | 
						if (wp->fd == -1 && WIFEXITED(status))
 | 
				
			||||||
 | 
							format_add(ft, "pane_dead_status", "%d", WEXITSTATUS(status));
 | 
				
			||||||
 | 
						format_add(ft, "pane_dead", "%d", wp->fd == -1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (window_pane_visible(wp)) {
 | 
						if (window_pane_visible(wp)) {
 | 
				
			||||||
		format_add(ft, "pane_left", "%u", wp->xoff);
 | 
							format_add(ft, "pane_left", "%u", wp->xoff);
 | 
				
			||||||
		format_add(ft, "pane_top", "%u", wp->yoff);
 | 
							format_add(ft, "pane_top", "%u", wp->yoff);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								server.c
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								server.c
									
									
									
									
									
								
							@@ -441,6 +441,7 @@ server_child_exited(pid_t pid, int status)
 | 
				
			|||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		TAILQ_FOREACH(wp, &w->panes, entry) {
 | 
							TAILQ_FOREACH(wp, &w->panes, entry) {
 | 
				
			||||||
			if (wp->pid == pid) {
 | 
								if (wp->pid == pid) {
 | 
				
			||||||
 | 
									wp->status = status;
 | 
				
			||||||
				server_destroy_pane(wp);
 | 
									server_destroy_pane(wp);
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										1
									
								
								tmux.1
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								tmux.1
									
									
									
									
									
								
							@@ -3117,6 +3117,7 @@ The following variables are available, where appropriate:
 | 
				
			|||||||
.It Li "pane_bottom" Ta "" Ta "Bottom of pane"
 | 
					.It Li "pane_bottom" Ta "" Ta "Bottom of pane"
 | 
				
			||||||
.It Li "pane_current_command" Ta "" Ta "Current command if available"
 | 
					.It Li "pane_current_command" Ta "" Ta "Current command if available"
 | 
				
			||||||
.It Li "pane_dead" Ta "" Ta "1 if pane is dead"
 | 
					.It Li "pane_dead" Ta "" Ta "1 if pane is dead"
 | 
				
			||||||
 | 
					.It Li "pane_dead_status" Ta "" Ta "Exit status of process in dead pane"
 | 
				
			||||||
.It Li "pane_height" Ta "" Ta "Height of pane"
 | 
					.It Li "pane_height" Ta "" Ta "Height of pane"
 | 
				
			||||||
.It Li "pane_id" Ta "#D" Ta "Unique pane ID"
 | 
					.It Li "pane_id" Ta "#D" Ta "Unique pane ID"
 | 
				
			||||||
.It Li "pane_in_mode" Ta "" Ta "If pane is in a mode"
 | 
					.It Li "pane_in_mode" Ta "" Ta "If pane is in a mode"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user