X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Thu, 10 Jan 2008 17:11:40 -0500 (EST) From: Igor Peshansky Reply-To: cygwin AT cygwin DOT com To: =?ISO-8859-1?Q?Sven_K=F6hler?= cc: cygwin AT cygwin DOT com Subject: Re: [BUG?] run.exe and pdflatex In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="-559023410-1297389768-1200003100=:8742" Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Note-from-DJ: This may be spam ---559023410-1297389768-1200003100=:8742 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT On Thu, 10 Jan 2008, Sven Köhler wrote: > > Finally, you can look at the sources for run.exe (available via Cygwin > > setup) and submit a patch (look at the first argument to > > CreateProcess). > > Hmm. So indeed run seems to use the Windows-API to create the new > rprocess. But that pdfetex knows, that is has been invoked by the name > pdflatex, must be an internal cygwin thing. Because actually, when > executing pdflatex from bash, cygwin must follow the symlink and then > executed pdfetex.exe. Still, cygwin reports to pdfetex, that it was > invoked with the command pdflatex. > > So i have no clue where to start here. Try MSDN: (MSDN used to have much MUCH nicer URLs that actually contained the name of the function the page described, but someone at Microsoft must've decided that it made life too easy for the programmers). > Actually, i wrote a small C program. And sure, it will not hide the > console window, when startes. But it simply uses execve to start the > program given in the parameter list: > > #include > #include > > int main(int argc, char * argv[]) > { > if (argc < 2) > { > printf("you must give some parameters\n"); > return 1; > } > > int i = execve(argv[1], argv+1, NULL); > > printf("execve failed: %i\n", i); > return 2; > } > > I'm amazed, it even works. Anyway: after compiling it under cygwin and > putting it to /bin/myrun.exe it's possible for me to successfully start > pdflatex by using > > c:\path\to\cygwin\bin\myrun.exe /usr/bin/pdflatex document.tex > > Hmm. I'm not sure, in which troubles i get by going this way. No need to be amazed, once you've read the spec for execve and understood the purpose of each parameter. What you're essentially doing here is exactly what using "bash -c" would've done, but without bash (kinda like that thing with Einstein explaining radio). In fact, you can do this with bash as well, by noting that the arguments do not have to appear in quotes (try running the following: bash -c "exec /bin/echo \$@" some arguments here and see what's printed; then read the bash man page for why this happens). However, the above is *not* equivalent to using run.exe in that it will not hide the console window (try it from a GUI). To do this hiding, run.exe *has* to use Win32 API like CreateProcess. This isn't to say, though, that the code cannot be fixed to do what you asked. Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT com ZZZzz /,`.-'`' -. ;-;;,_ Igor Peshansky, Ph.D. (name changed!) |,4- ) )-,_. ,\ ( `'-' old name: Igor Pechtchanski '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "That which is hateful to you, do not do to your neighbor. That is the whole Torah; the rest is commentary. Go and study it." -- Rabbi Hillel ---559023410-1297389768-1200003100=:8742 Content-Type: text/plain; charset=us-ascii -- 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/ ---559023410-1297389768-1200003100=:8742--