[TxMt] Re: TextMate 1.5 and Ruby 2.0.0

Allan Odgaard mailinglist at textmate.org
Thu Mar 7 18:51:44 UTC 2013


On Mar 7, 2013, at 5:45 PM, Matt Neuburg <matt at tidbits.com> wrote:

> Allan Odgaard wrote:
> 
>> If it works, try this code as well:
>> 
>>    rd, wr = IO.pipe
>>    fork do
>>      io = IO.for_fd(wr.to_i)
>>      io << "test\n"
>>      io.close
>>    end
>>    puts rd.gets

Did you run the above with Ruby 2.0?

> […] If we feed the HTML to just any old IO (such as 2), it isn't formatted; it appears as raw HTML in the output window.

Yes, “RubyMate” will treat data from your program’s stdout (and stderr) as “raw” and in need of escaping. However, it creates a pipe that can be written to, which should be HTML. The TM_ERROR_FD is the “file descriptor” pointing to the write-end of this pipe.

> […] I tried just running this script as a way of seeing what file
> descriptors are good and what file descriptors are bad: […]

Basically file descriptors are represented via integers, but the integer is just an index into a table of open files/pipes. So whether or not a given integer is a valid file descriptor depends on wether or not there is an entry in the process’ table.

File descriptor 0, 1, and 2 though are normally setup as stdin, stdout, and stderr.



More information about the textmate mailing list