Related to pharo-project/pharo#694 You can view, comment on, or merge this pull request online at:https://github.com/OpenSmalltalk/opensmalltalk-vm/pull/254 Commit Summary
File Changes
Patch Links:
— |
@VincentBlondeau pushed 1 commit.
— |
In reply to this post by David T Lewis
Hi Vincent, in isStdioDescriptorATTY at line 898 there is no guard to check if pGetFileInformationByHandleEx has already been fetched. The code needs to be something like
— |
In reply to this post by David T Lewis
Also, in platforms/Cross/plugins/FilePlugin/sqFilePluginBasicPrims.c, the comment "//There is always an TTY to write into for Unix and Mac" (and hence the implementation) is wrong. It should be something like sqInt sqStdioDescriptorIsATTY(void) { — |
In reply to this post by David T Lewis
Thanks Eliot for the piece of advice! I am not an expert in C yet ;) I made the changes but I was wondering why it is needed to set a guard: the line before just set the pGetFileInformationByHandleEx to NULL. — |
In reply to this post by David T Lewis
@VincentBlondeau pushed 1 commit.
— |
In reply to this post by David T Lewis
Hi Vincent, Just based on a quick visual inspection of the code:
Thanks! — |
> On 23-04-2018, at 10:34 PM, akgrant43 <[hidden email]> wrote: > > • Actually, since the result is always stored in the SQFile structure for the stdio streams, the primitive could just return the cached value rather than determining it every time. Unless it can change from external commands? tim -- tim Rowledge; [hidden email]; http://www.rowledge.org/tim Florida: more red in the face |
Hi Tim, On 24 April 2018 at 18:25, tim Rowledge <[hidden email]> wrote: > > > >> On 23-04-2018, at 10:34 PM, akgrant43 <[hidden email]> wrote: >> >> • Actually, since the result is always stored in the SQFile structure for the stdio streams, the primitive could just return the cached value rather than determining it every time. > > Unless it can change from external commands? I'm not aware of any way this can be done, but also don't claim any particular expertise (for a long time the VM has assumed that it doesn't change). If there is a way to change the stdio stream the correct approach is to ensure that the SQFile structure is updated appropriately, so it will still be OK to answer the cached value. Cheers, Alistair |
> On 24-04-2018, at 9:34 AM, Alistair Grant <[hidden email]> wrote: > > > Hi Tim, > > On 24 April 2018 at 18:25, tim Rowledge <[hidden email]> wrote: >> >> >> >>> On 23-04-2018, at 10:34 PM, akgrant43 <[hidden email]> wrote: >>> >>> • Actually, since the result is always stored in the SQFile structure for the stdio streams, the primitive could just return the cached value rather than determining it every time. >> >> Unless it can change from external commands? > > I'm not aware of any way this can be done, but also don't claim any > particular expertise (for a long time the VM has assumed that it > doesn't change). Likewise with the not knowing. I tend to the paranoid when it comes to outside resources. Can a file descriptor/stream be changed ? Betting against it being possible on any of the platforms we use is probably a poor idea to be honest. > > If there is a way to change the stdio stream the correct approach is > to ensure that the SQFile structure is updated appropriately, so it > will still be OK to answer the cached value. If it were possible to change the status from outside the image and there were some sort of notifier from the OS we'd be ok. Otherwise it's often smart to treat it as a volatile variable. It's like testing that a file exists and is writable and relying upon that staying true over a long period- usually ok but definitely not safe. tim -- tim Rowledge; [hidden email]; http://www.rowledge.org/tim Implementation is the sincerest form of flattery. |
In reply to this post by David T Lewis
@VincentBlondeau pushed 2 commits.
— |
In reply to this post by David T Lewis
Closed #254. — |
In reply to this post by David T Lewis
Reopened #254. — |
In reply to this post by David T Lewis
Hi Vincent, shouldn't all the — |
In reply to this post by David T Lewis
The exposed primitive sqIsFileDescriptorATTY should not receive an HANDLE because one needs to call sqIsFileDescriptorATTY to know if an handle is available. But I can change sqWin32FilePrims.c:isFileDescriptorATTY to take an HANDLE as argument instead of a String — |
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, After checking out and building VincentBlondeau:addStdoutIsConsolePrimitive I get:
Sorry, but I'm out of time for today. Hopefully I'll get to investigate a bit more over the coming days. Cheers, — |
In reply to this post by David T Lewis
@VincentBlondeau pushed 1 commit.
— |
In reply to this post by David T Lewis
I was using the wrong function to convert the handle to a number. I found another solution that works, now, I hope it will be working — |
Free forum by Nabble | Edit this page |