Return-Path: Delivered-To: apmail-ant-user-archive@www.apache.org Received: (qmail 45366 invoked from network); 24 Apr 2007 17:30:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Apr 2007 17:30:40 -0000 Received: (qmail 36974 invoked by uid 500); 24 Apr 2007 17:30:41 -0000 Delivered-To: apmail-ant-user-archive@ant.apache.org Received: (qmail 36812 invoked by uid 500); 24 Apr 2007 17:30:41 -0000 Mailing-List: contact user-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Users List" Reply-To: "Ant Users List" Delivered-To: mailing list user@ant.apache.org Received: (qmail 36800 invoked by uid 99); 24 Apr 2007 17:30:41 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Apr 2007 10:30:41 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of chris.dudley@gmail.com designates 64.233.162.230 as permitted sender) Received: from [64.233.162.230] (HELO nz-out-0506.google.com) (64.233.162.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 24 Apr 2007 10:30:34 -0700 Received: by nz-out-0506.google.com with SMTP id j2so1815639nzf for ; Tue, 24 Apr 2007 10:30:13 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=JaTy9OhV5zQEXd4550HO9NMI/Sn7Yr5M0xJGwMbGao+VlwktbJa4D73voH75JiQvYTwBN4tbF6JwTLr5hp3VUFabN9CIh4UqkJ3wDEjx10qYkjiq0n08rihAuLl6vkq5UajTEBqRui5+Y+3sp0YEPSg5AKmOvHSZSCNwgNA859o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=PtDEdJNzTrmf5XdRF3m0Ffc0hMEXLgtGTQfN6QUL7pWi3QJ86BG3XvFz7pkHKSpdCv0P97J7ML/Imj09UTCPwhO6O/sTxWHsIb1y6WQx9N1zzbBYtFr4OSfejn4teJS8D/z/bV/XnOwViPXxzzx3h0C/oNClwLp1wcfiuBJgrN8= Received: by 10.114.121.1 with SMTP id t1mr397065wac.1177435812500; Tue, 24 Apr 2007 10:30:12 -0700 (PDT) Received: by 10.114.200.16 with HTTP; Tue, 24 Apr 2007 10:30:12 -0700 (PDT) Message-ID: <9b6e13750704241030v7b3b360ei38246804af97f71e@mail.gmail.com> Date: Tue, 24 Apr 2007 18:30:12 +0100 From: "Chris Dudley" To: user@ant.apache.org Subject: Exec on Windows ignores return code? MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Checked: Checked by ClamAV on apache.org Apologies if this is a FAQ or a known problem but I couldn't find anything useful in the archives, google or in bugzilla. I am having trouble with the exec task on Windows. It seems to me that regardless of what the executable returns, ANT always claims the return code on Windows is 0. The code below runs a simple test batch file. The batch file is hardcoded to always return 1. Running the batch file from a command prompt and then echoing %ERRORLEVEL% does indeed show the return code to be 1 and not 0. So where is ANT getting the 0 return code from? I have tried a similar test on Linux and UNIX (not using a batch script of course) and it works perfectly. But yet I don't think this is a peculiarity of Windows since %ERRORLEVEL% is being set correctly - ANT just isn't picking it up. I have tried ANT 1.6.2, 1.6.5 and 1.7.0 - all seem to exhibit the same behaviour. I am hoping there is a workaround or a simple solution to something stupid I've done! Thanks! This is the ANT snippet: test.bat contains just one line: exit /B 1 This is what comes out when ant is run with debug on: [exec] Current OS is Windows XP [exec] Executing 'cmd' with arguments: [exec] '/c' [exec] 'C:\install\test.bat' [exec] [exec] The ' characters around the executable and arguments are [exec] not part of the command. Execute:Java13CommandLauncher: Executing 'cmd' with arguments: '/c' 'C:\install\test.bat' The ' characters around the executable and arguments are not part of the command. [exec] [exec] C:\>exit /B 1 Setting project property: error -> 0 [echo] error=0 I really want ANT to abort the build if the executable returns non-zero, which works fine on UNIX but I need it to work on Windows too. Any ideas please? --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@ant.apache.org For additional commands, e-mail: user-help@ant.apache.org