Return-Path: X-Original-To: apmail-groovy-users-archive@minotaur.apache.org Delivered-To: apmail-groovy-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7435717F23 for ; Thu, 2 Apr 2015 20:40:01 +0000 (UTC) Received: (qmail 41913 invoked by uid 500); 2 Apr 2015 20:40:01 -0000 Delivered-To: apmail-groovy-users-archive@groovy.apache.org Received: (qmail 41874 invoked by uid 500); 2 Apr 2015 20:40:01 -0000 Mailing-List: contact users-help@groovy.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@groovy.incubator.apache.org Delivered-To: mailing list users@groovy.incubator.apache.org Received: (qmail 41864 invoked by uid 99); 2 Apr 2015 20:40:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Apr 2015 20:40:01 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [205.214.170.150] (HELO ds2.netgate.net) (205.214.170.150) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Apr 2015 20:39:55 +0000 X-No-Relay: not in my network Received: from Henriks-Mac-mini.local (184-105-177-98.static.hilltopinternet.com [184.105.177.98]) by ds2.netgate.net (Postfix) with ESMTPSA id 9534D36024 for ; Thu, 2 Apr 2015 13:38:58 -0700 (PDT) Message-ID: <551DA903.7080703@netgate.net> Date: Thu, 02 Apr 2015 13:39:31 -0700 From: Henrik Martin Reply-To: henrik@netgate.net, henrik@netgate.net User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: users@groovy.incubator.apache.org Subject: Limitation on size for argument list when using String.execute()? Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi. I'm running into what seems to be some sort of limitation on the number of arguments passed to the execute() method. I have a Groovy class that calculates a set of database tables, and then executes the Postgres pg_dump command, where each table is specified with the -t option. I'm basically trying to dump the database, but only the specified tables. I'm using the List version of execute (found an example on the codehaus.org site). A little simplified, the code looks something like this: // Returns a list like ["-t", "foo", "-t", "bar", "-t", ...] def tableArgs = tablesToDump() ["$pgDump", '-a', '-n', 'public', '-f', "${tmpFile.path}", '-h', "$dbHost", '-p', "$dbPort", '-U', "$srcDbUser", '-d', "$srcDb"].plus(tableArgs).execute() In some cases, the list of -t table pairs can get quite long. So I'm running into situations where the output from the pg_dump command doesn't contain the data for some tables. The command succeeds with no errors, but I'm not getting the expected output from the database. However, if I instead of calling execute(), just print the command string and execute it manually from a shell, then things work. This makes me think that I'm running into some limitation of the execute() method. I have scoured the Groovy Lang/GDK documentation, but haven't found any mentioning of that. I'm guessing that Groovy uses the Java Runtime.exec() method under the covers, but I'm not aware of any documented limitations for Runtime.exec() either. I like the convenience of using Groovy's execute() mechanism with the easy processing of stdin/stdout/stderr, so I'd like to stick to it unless some potential limitation forces me not to. In case it's of relevance, I'm running on MacOS 10.10.2, with Oracle Java version 1.8.0_25-b17, and Groovy 2.3.10. Any help is much appreciated. Thanks, -H