Created
January 3, 2012 18:58
-
-
Save bookshelfdave/1556316 to your computer and use it in GitHub Desktop.
RubyIO tweak
This file contains 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
public IRubyObject stat(ThreadContext context) { | |
openFile.checkClosed(context.getRuntime()); | |
try { | |
if(this.popenSpecial == true) { | |
/* | |
This seems to work in OSX, but not Windows. I'm not sure how the impl of | |
file descriptors differs in Win32. Any ideas? | |
*/ | |
int fd = (int)this.fileno(context).getLongValue(); | |
// ends up calling POSIX.fstat(int) | |
return context.getRuntime().newFileStat(fd); | |
} else { | |
return context.getRuntime().newFileStat(getOpenFileChecked().getMainStreamSafe().getDescriptor().getFileDescriptor()); | |
} | |
} catch (BadDescriptorException e) { | |
throw context.runtime.newErrnoEBADFError(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment