Add java.io.FileDescriptor#124
Open
summer-alice wants to merge 3 commits intod-widget-toolkit:4.7from
Open
Conversation
Down the line this will allow FileOutputStream.this(FileDescriptor) to work for STDIN, STDOUT, and STDERR System.out and co. outline: https://stackoverflow.com/a/14435324
'const' from fFD and fHandle were removed to allow 'setting' in the future.
Was used when in_, out_, and err were immutable but isn't required now.
Member
|
Is this ported from the Java source code or is a reimplementation? |
Comment on lines
+33
to
+42
| package int getFD() | ||
| { | ||
| return fFD; | ||
| } | ||
|
|
||
| /// Windows file HANDLE | ||
| package void* getHandle() | ||
| { | ||
| return fHandle; | ||
| } |
Member
There was a problem hiding this comment.
Should these be const as well? Otherwise they cannot be on the constants below.
| version (Posix) { | ||
| return fFD >= 0; | ||
| } else version (Windows) { | ||
| return (fFD >= 0) && (fHandle !is null); |
Member
There was a problem hiding this comment.
Is fFD ever used on Windows?
| * Usually, this file descriptor is not used directly, but rather via the | ||
| * output stream known as `System.in`. | ||
| */ | ||
| public static const FileDescriptor in_; |
Member
There was a problem hiding this comment.
I don't know if there are other static variables which are objects in the code base, but these are thread local storage, do we want that?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I want to get System.{in,out,err} to allow the SWTException and SWTError tests to be fully implemented. In particular, this would allow the
.printStackTraceto useSystem.err_. I think it would also just be fun to have the streams working in general 😄By default, each of the PrintStreams are File{Input,Output}Stream which use a FileDescriptor (ref).