1. Using Cygwin with EUPHORIA
- Posted by SDPringle Apr 20, 2012
- 1237 views
As I have mentioned before I often use cygwin's command line shell rather than mingw or cmd for command line processing. For those who have tried Unix like OSes. I am writing a command line application that I use for renaming files according to some pattern. As long as no error occurs, the program will do its task. However, if it needs to print out an error message and abort, I never see the error. The command line prompt comes back as if the program crashed.
This issue doesn't show up in using this from the standard command line in Windows. It's a good thing cmd.exe has command line completion now. This is not a problem under Ming either. This is not really a EUPHORIA 'problem' because many programs have this issue. For instance python.
The problem seems to be is that Windows' low level console handling interprets the file handles cygwin uses to communicate with its sub process (EUPHORIA) are not recognized as belonging to an interactive process and so I/O is handled differently.
A process needs special privilege in order to determine what a process handle is (using WINAPI side). AFAIK even if its the parent of the current process. We could try to check if cygwin.dll is on the system and then use getpid. The problem is, Cygwin maintains its own set of pids. So, we can't load the dll and use POSIX to determine if it is a Cygwin process.
Does someone know some other work around?
Okay, yes, use ming. I mean besides that.
2. Re: Using Cygwin with EUPHORIA
- Posted by mattlewis (admin) Apr 20, 2012
- 1248 views
This issue doesn't show up in using this from the standard command line in Windows. It's a good thing cmd.exe has command line completion now. This is not a problem under Ming either. This is not really a EUPHORIA 'problem' because many programs have this issue. For instance python.
Basically, these terminals just use stdout and stderr. Euphoria uses special Windows console output functions (unless output's being redirected), and so you don't see anything on these sorts of terminals. The same thing happens when running eui.exe under Wine, unless you create Wine's cmd replacement.
I believe that you should be able to set a EUCONS environment variable equal to 1 to get stdout/err output. Or maybe that just works for stderr. I can recall, in the past, doing things like:
$ eui.exe myapp.ex | cat
I've also used custom printf/puts implementations in the past (though this was on Linux, when euphoria still used ncurses): http://www.rapideuphoria.com/stdinout.eu
Matt
3. Re: Using Cygwin with EUPHORIA
- Posted by SDPringle Apr 20, 2012
- 1168 views
Setting EUCONS to 1 fixes the problem! I am going to set this in /etc/profile now. It's a pity we cannot detect that EUPHORIA is running under Cygwin's shell and then set this behavior automatically. However, it is easier to put this under possible problems in the 'Installation' section of the manual.
4. Re: Using Cygwin with EUPHORIA
- Posted by SDPringle Apr 20, 2012
- 1172 views
By the way, thank you Matt.