From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6271 invoked by alias); 14 Aug 2011 19:55:55 -0000 Received: (qmail 6260 invoked by uid 22791); 14 Aug 2011 19:55:54 -0000 X-SWARE-Spam-Status: No, hits=-7.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 14 Aug 2011 19:55:37 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7EJtSR5023598 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 14 Aug 2011 15:55:28 -0400 Received: from host1.jankratochvil.net (ovpn-116-17.ams2.redhat.com [10.36.116.17]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p7EJtPMp002252 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 14 Aug 2011 15:55:27 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p7EJtOZh007659; Sun, 14 Aug 2011 21:55:24 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p7EJtN3m007652; Sun, 14 Aug 2011 21:55:23 +0200 Date: Sun, 14 Aug 2011 19:55:00 -0000 From: Jan Kratochvil To: Eli Zaretskii Cc: abhijit.k.halder@gmail.com, sergiodj@redhat.com, tromey@redhat.com, pedro@codesourcery.com, gdb-patches@sourceware.org Subject: Re: [PATCH] An implementation of pipe to make I/O communication between gdb and shell. [MinGW question] Message-ID: <20110814195523.GA7588@host1.jankratochvil.net> References: <20110813205053.GB22058@host1.jankratochvil.net> <20110814121407.GA29236@host1.jankratochvil.net> <83y5ywulun.fsf@gnu.org> <20110814170136.GA26819@host1.jankratochvil.net> <83sjp3vkze.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83sjp3vkze.fsf@gnu.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-08/txt/msg00294.txt.bz2 On Sun, 14 Aug 2011 21:41:57 +0200, Eli Zaretskii wrote: > > Abhijit Halder has suggested the suggested > > const char *argv[] = { "sh", "-c", "cat >/dev/null", NULL }; > > pex_run (pipe->pex, PEX_LAST, "/bin/sh", argv, NULL, NULL, &status); > > works on UNIX but it will probably not work on MinGW as there is no "/bin/sh", > > is it? > > The file name of the shell, the "-c" switch, and the null device > should all be system-dependent. For MinGW, they should be, > respectively, "cmd.exe", "/c", and "nul". "cat >/dev/null" itself is user-entered command so that part is OK to be non-cross-platform (therefore also "nul" is not valid). OK, "cmd.exe" with "/c" seems easy enough. > > The current implementation: > > const char *argv[] = { "cat", ">/dev/null", NULL }; > > pex_run (pipe->pex, PEX_SEARCH | PEX_LAST, "cat", argv, NULL, NULL, &status); > > produces that - therefore not working on UNIX: > > cat: >/dev/null: No such file or directory > > How hard is it to parse the redirection characters? Very, >, >>, &>, >&, &>>, x>&y, x>&y-, x<>y, many more. Thanks, Jan