X-Spam-Check-By: sourceware.org Message-ID: <460159FB.3020408@fit.vutbr.cz> Date: Wed, 21 Mar 2007 17:14:51 +0100 From: PCJohn User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: rxvt isatty Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 Hi all, I found the possible solution. I have just a question whether Cygwin's pty's behaviour is changed often and whether it should work throughout the many past releases of Cygwin. On MSVC, it is possible to use GetNamedPipeInfo() and GetNamedPipeHandleState() and based on their behaviour, to distinguish between all different possibilities: // // results from rxvt: // // ./pipetest // stdin: SERVER_END pipe, name: John // // ./pipetest I was trying to port ivTools >(http://merlin.fit.vutbr.cz/wiki/index.php?title=Open_Inventor_Tools) to > work smoothly with Cygwin. It works on Cygwin console without problems >($CYGWIN=notty), but rxvt causes all the utilities to freeze. > >I found the problem: utilities are testing stdin by isatty. If >isatty==false, stdin is used for reading the data. If isatty returns >true, there is really bad idea to wait that user will feed the program >by complex 3D geometry, and utility is started without reading stdin. > >If rxvt is used, isatty returns always false and application does not >work as expected. I realized that some advanced console functionality is >provided with rxvt (pty, pipes) to overcome the limitations of windows >console. My question: Can I find out in if the application is running >interactive or not? If it was started like: >app_name.exe < in.txt >echo data | app_name.exe >or >app_name.exe > >Another minor question: How to use the advanced functionalities provided >by pty and pipes? Just get_osfhandle(fileno(stdin)), ReadFile, and >WriteFile? Given that you're talking about things like isatty returning false, get_osfhandle, ReadFile, and WriteFile, I surmise that you're trying to run a non-Cygwin-based program under rxvt. None of those are Linux/UNIX functions and, if you use them in a Cygwin program there are no guarantees that you will be able to use any of Cygwin's UNIX/Linux-like features. Cygwin's ptys are entirely an invention of Cygwin so, to avail yourself of ptys you can't build the application with MSVC or gcc -mno-cygwin or MinGW gcc. You really need to build your program so that it uses the cygwin dll, i.e., it has to be compiled with the normal Cygwin gcc. -- 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/