Hi Vincent, This still isn't working because
I think that gets the basic changes you wanted done. But it still I don't understand what ReadConsole() and WriteConsole() provide in Eliot, what are your thoughts about moving the stdio functionlity to use I think that would allow the VM to use fread(), feof(), and fwrite() to Another option may be to leave the existing console functionality and (we should probably move this conversation to vm-dev and out of this Thanks, — |
In reply to this post by David T Lewis
I forgot that structs are directly stored in the array without pointer to them. I fixed it. — |
In reply to this post by David T Lewis
@VincentBlondeau pushed 1 commit.
— |
In reply to this post by David T Lewis
@VincentBlondeau pushed 1 commit.
— |
In reply to this post by David T Lewis
Hi Vincent & Eliot,
Sure - if you start PharoConsole.exe from within a cygwin (mintty) That's because the read and write primitives rely on the Windows When we started these modifications I assumed that it would be possible As an example, attempting to use the MingW/MS fread() function and
Someone please explain how I am wrong and how to get stdio working on Thanks, — |
Hi Alistair,
|
In reply to this post by David T Lewis
Hi Vincent & Eliot,
I think it is worse than that. If I use the following test code in a
And compile it with mingw:
It won't recognise EOF (Control-D).
If I compile it with gcc:
It works as expected:
So the best option I see for supporting both cygwin terminals and dos
I'd still like to be proved wrong... Thanks, — |
On 27 April 2018 at 15:16, akgrant43 <[hidden email]> wrote: Â Try Ctrl-Z "In a non-Cygwin Windows program, Ctrl-Z on input triggers an end-of-file condition." cheers -ben |
In reply to this post by David T Lewis
Hi Ben,
I had tried this, and since it's bash it just stopped the program, as expected. I'd also looked at the page you referenced, but on reading it again thought I'd try unsetting the susp key:
And sure enough, running the mingw version works this time:
While it is a workaround, I'm not sure that asking users to modify the terminal settings and remember to use Ctrl-Z instead of Ctrl-D for Pharo in bash is going to be practical. What do you think? Just for LOLs, the following does work:
It doesn't work in headless mode, I haven't figured out why yet. Cheers, — |
On 27 April 2018 at 19:18, akgrant43 <[hidden email]> wrote: While it is a workaround, I'm not sure that asking users to modify the terminal settings and remember to use Ctrl-Z instead of Ctrl-D for Pharo in bash is going to be practical. Probably not. It just helps characterize the problem better. cheers -ben |
In reply to this post by David T Lewis
Hi Eliot & Vincent, On 27 April 2018 at 09:16, akgrant43 <[hidden email]> wrote: > > > > > But I don't get it. IIRC, it used to be the case that ReadConsole/WriteConsole worked in both. > > I'd still like to be proved wrong... This thread has been quiet for a few days, so I guess my wishes aren't met and there isn't a way to have a program work in both Windows Consoles and cygwin terminals. One of the articles forwarded by Ben suggested the workaround is to have a .com version of the program, which does all the work if the command line arguments only require console i/o. If a gui is required, it relaunches the .exe version which then opens the windows. We could extend that to also check for cygwin and relaunch a cygwin exe. However I think that is effectively adding another platform to support, which is more effort than I want to put in. Assuming all of the above, I think we might as well (reluctantly) rip out the code that tests for cygwin terminals and just leave Vincent's primitives in. This will at least allow the image to properly determine whether it can write to the console or if it should create files instead. What do you think? Thanks, Alistair |
Actually, the primitive needs to be an enumerated value indicating one of: - no console (windows only) - console / terminal - pipe - file Cheers, Alistair (on phone) On Tue., 1 May 2018, 07:56 Alistair Grant, <[hidden email]> wrote: Hi Eliot & Vincent, |
In reply to this post by David T Lewis
So this is real goodness. Can we not address the issues and get this in? Right now as I understand it we know how to discover both a Cygwin console and a Windows Console, but the two require separate approaches. Can we not add both of them? As far as the end-of-file issue dgoes I would say that is not a deal breaker. If I were implementing a REPL I would want EOF to cause the system to exit cleanly but I would also live with having to issue a proper quit command. — |
In reply to this post by David T Lewis
Hi Eliot and Vincent, (I only have phone access, so apologies for typos, formatting, etc.) Unless I'm misunderstanding the situation, we can't easily add support We're compiling and linking with mingw, which means we have access to I guess it would be possible to write a wrapper DLL around the posix io Given your acceptance of not recognising EOF correctly in a cygwin 0 - no console (windows only) What do you think? Cheers, — |
In reply to this post by David T Lewis
Hi Alistair,
— |
In reply to this post by David T Lewis
Great, I think we're in agreement. Vincent, what do you think? Cheers, — |
In reply to this post by David T Lewis
Sounds good! The only thing is I can check the result only under windows. So, I don't know which values to return for Linux if the terminal is not a tty. Should I return 2 or 3? And how do I know that is a file or a pipe? — |
In reply to this post by David T Lewis
Hi Vincent,
0 - no console (windows only) I expect it'll be fine for you to extend the windows code but leave the Unix code for Alistair to implement. — |
In reply to this post by David T Lewis
Hi Vincent, I assumed that for Windows you could already distinguish between pipes and normal files since the pty check uses the pipe name as part of its check. If not... The fstat() st_mode field has S_IFIFO which indicates a first-in first-out (pipe) file. Some of the documentation I saw said that S_IFIFO is for named pipes, I don't know what it will return for stdin being a pipe. fstat() takes a file descriptor, so you'll need to convert a HANDLE to a fd. If you can get Windows working I'm happy to take care of the Unix side. Cheers, — |
In reply to this post by David T Lewis
@VincentBlondeau pushed 2 commits. — |
Free forum by Nabble | Edit this page |