forked from ungleich-public/cdist
		
	only trap signals in front end scripts
Otherwise children execute kill egain and the shell segfaults Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								56cf428d4c
							
						
					
				
			
			
				commit
				
					
						6f99de75a5
					
				
			
		
					 3 changed files with 8 additions and 3 deletions
				
			
		|  | @ -355,6 +355,8 @@ __cdist_tmp_removal() | ||||||
|    rm -rf "${__cdist_tmp_dir}" |    rm -rf "${__cdist_tmp_dir}" | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | # Does not work in children, will be called again in every script! | ||||||
|  | # Use only in interactive "front end" scripts | ||||||
| __cdist_kill_on_interrupt() | __cdist_kill_on_interrupt() | ||||||
| { | { | ||||||
|    __cdist_tmp_removal |    __cdist_tmp_removal | ||||||
|  | @ -364,9 +366,6 @@ __cdist_kill_on_interrupt() | ||||||
| # Remove tempfiles at normal exit | # Remove tempfiles at normal exit | ||||||
| trap __cdist_tmp_removal EXIT | trap __cdist_tmp_removal EXIT | ||||||
| 
 | 
 | ||||||
| # Kill children on interrupt |  | ||||||
| trap __cdist_kill_on_interrupt INT TERM |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| ################################################################################ | ################################################################################ | ||||||
| # Type | # Type | ||||||
|  |  | ||||||
|  | @ -25,6 +25,9 @@ | ||||||
| [ $# -eq 1 ] || __cdist_usage "<target host>" | [ $# -eq 1 ] || __cdist_usage "<target host>" | ||||||
| set -eu | set -eu | ||||||
| 
 | 
 | ||||||
|  | # Kill children on interrupt - only in interactive scripts | ||||||
|  | trap __cdist_kill_on_interrupt INT TERM | ||||||
|  | 
 | ||||||
| __cdist_target_host="$1" | __cdist_target_host="$1" | ||||||
| 
 | 
 | ||||||
| # Make target host available for non-core | # Make target host available for non-core | ||||||
|  |  | ||||||
|  | @ -25,6 +25,9 @@ | ||||||
| [ $# -ge 1 ] || __cdist_usage "[-p] <target host> [target host ]" | [ $# -ge 1 ] || __cdist_usage "[-p] <target host> [target host ]" | ||||||
| set -u | set -u | ||||||
| 
 | 
 | ||||||
|  | # Kill children on interrupt - only in interactive scripts | ||||||
|  | trap __cdist_kill_on_interrupt INT TERM | ||||||
|  | 
 | ||||||
| filter() | filter() | ||||||
| { | { | ||||||
|    awk -v host=$1 '{ print "[" host "] " $0 }' |    awk -v host=$1 '{ print "[" host "] " $0 }' | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue