mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Fix buffer_output
This commit is contained in:
		@@ -438,15 +438,20 @@ function cluster::mesos::docker::create_basic_user {
 | 
				
			|||||||
  echo "${password},${user_name},${user_name}"
 | 
					  echo "${password},${user_name},${user_name}"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Buffers command output to memory, prints on failure.
 | 
					# Buffers command output to file, prints output on failure.
 | 
				
			||||||
function cluster::mesos::docker::buffer_output {
 | 
					function cluster::mesos::docker::buffer_output {
 | 
				
			||||||
  local cmd="$@"
 | 
					  local cmd="$@"
 | 
				
			||||||
 | 
					  local tempfile="$(mktemp "${TMPDIR}/buffer.XXXXXX")"
 | 
				
			||||||
  # buffer output until failure
 | 
					  trap "kill -TERM \${PID}; rm '${tempfile}'" TERM INT
 | 
				
			||||||
  local output=$((${cmd} || exit $?) 2>&1)
 | 
					  ${cmd} &> "${tempfile}" &
 | 
				
			||||||
 | 
					  PID=$!
 | 
				
			||||||
 | 
					  wait ${PID}
 | 
				
			||||||
 | 
					  trap - TERM INT
 | 
				
			||||||
 | 
					  wait ${PID}
 | 
				
			||||||
  local exit_status="$?"
 | 
					  local exit_status="$?"
 | 
				
			||||||
  if [ "${exit_status}" != 0 ]; then
 | 
					  if [ "${exit_status}" != 0 ]; then
 | 
				
			||||||
    echo "${output}" 1>&2
 | 
					    cat "${tempfile}" 1>&2
 | 
				
			||||||
    return "${exit_status}"
 | 
					 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					  rm "${tempfile}"
 | 
				
			||||||
 | 
					  return "${exit_status}"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user