From owner-freebsd-hackers@FreeBSD.ORG Fri Jun 25 13:30:58 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7F751106566B for ; Fri, 25 Jun 2010 13:30:58 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id 4597C8FC24 for ; Fri, 25 Jun 2010 13:30:58 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id BA5C335A85B; Fri, 25 Jun 2010 15:30:56 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id A984A172DB; Fri, 25 Jun 2010 15:30:56 +0200 (CEST) Date: Fri, 25 Jun 2010 15:30:56 +0200 From: Jilles Tjoelker To: Patrick Mahan Message-ID: <20100625133056.GA97679@stack.nl> References: <4C21A743.6040306@mahan.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4C21A743.6040306@mahan.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: freebsd-hackers@freebsd.org Subject: Re: Help with some makefile hackery X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jun 2010 13:30:58 -0000 On Tue, Jun 22, 2010 at 11:18:43PM -0700, Patrick Mahan wrote: > src-kern-tools: > cd src; ./-kernel-toolchain.sh 2>&1 | tee The pipeline will return the status of 'tee' which is almost always 0. The exit status of the build script is ignored. A simple fix is store the status in a file and refer to that afterwards. Another fix uses a separate file descriptor to pass through the status, like { st=$( { { ./kernel-toolchain.sh 2>&1 3>&- 4>&-; echo $? >&3; } | tee logfile >&4 } 3>&1) } 4>&1 but this is fairly complicated. The issue can be sidestepped entirely by sending the output to a file only; a developer can use tail -f to follow the build if necessary. -- Jilles Tjoelker