delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/01/03/18:56:08

X-Spam-Check-By: sourceware.org
X-ME-UUID: 20070103235552978 DOT EEC9C1C00082 AT mwinf3009 DOT me DOT freeserve DOT com
Message-ID: <002101c72f9a$84da0c20$d4d94c51@default>
From: "Ciarán Ó Duibhín" <ciaran AT oduibhin DOT freeserve DOT co DOT uk>
To: <cygwin AT cygwin DOT com>
References: <000b01c72ba8$f99d8aa0$78d94c51 AT default> <Pine DOT GSO DOT 4 DOT 63 DOT 0612292136130 DOT 27982 AT access1 DOT cims DOT nyu DOT edu>
Subject: Re: Calling a cygwin binary from CreateProcess - problem with redirection
Date: Thu, 4 Jan 2007 00:51:48 -0000
MIME-Version: 1.0
X-Mailer: Microsoft Outlook Express 5.50.4807.1700
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Igor Peshansky wrote:

> Ciarán Ó Duibhín wrote:
> > Hi,
> >
> > I have no experience with cygwin, but I downloaded a Windows .exe which
> > is a unix program compiled for Windows with cygwin.  Several cygwin
> > dll's are included.
> >
> > I can run this program from the DOS command line.
> > An example command line is:
> > c:\progra~1\freeli~1.4\analyzer -f data\config\en.cfg < c:\split.txt >
> > new.txt
> >
> > But I would like to launch it from another Windows application - a
> > graphic interface I am writing for it, in fact.  However, when I supply
> > the above command line to the Windows CreateProcess function as the
> > lpCommandLine parameter, I get the error message
> > "CONFIG_OPTIONS: Error -11 parsing command line.
> >    unknown option '' at position 4 in command line"
> > ie. the redirection symbol <.  It doesn't matter whether or not there is
> > a space after the redirection symbol.
> >
> > This is the same error message as produced when a commandline parameter
> > which is genuinely in error is supplied to the program, so it seems that
> > the combination of CreateProcess and cygwin is passing the redirection
> > parameter to the program in some mutated form, whereas it arrives
> > correctly from the command line.
>
> Ciarán,
>
> CreateProcess() is not a shell -- it will pass all arguments (including
> your redirection specifiers) to the program.  This is not a
> Cygwin-specific problem -- you would have gotten the same errors with a
> pure Windows executable.
>
> You might want to read up on the arguments to CreateProcess on MSDN
> (especially the input/output handles in the STARTUPINFO structure).  If
> you have further questions, a Windows-specific list might be a better
> venue.

Thanks, Igor, that is correct of course.

A Google search for "CreateProcess" and "redirection" produced quite a lot
of information, and now my graphic interface is calling the (cygwin, as it
just happens) binary without any problems.

Ciarán.



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019