Sha256: 8066afb7216b72b3848dcea8d5c05c1f57ddd6c101100eade9a409d654adacb4
Contents?: true
Size: 946 Bytes
Versions: 13
Compression:
Stored size: 946 Bytes
Contents
%x{ function executeIOAction(action) { try { return action(); } catch (error) { if (error.code === 'EACCES' || error.code === 'EISDIR' || error.code === 'EMFILE' || error.code === 'ENOENT' || error.code === 'EPERM') { throw Opal.IOError.$new(error.message) } throw error; } } } class IO @__fs__ = `require('fs')` `var __fs__ = #{@__fs__}` attr_reader :eof attr_reader :lineno def initialize @eof = false @lineno = 0 end def self.write(path, data) File.write(path, data) end def self.read(path) File.read(path) end def self.binread(path) `return executeIOAction(function(){return __fs__.readFileSync(#{path}).toString('binary')})` end end STDOUT.write_proc = ->(string) { `process.stdout.write(string)` } STDERR.write_proc = ->(string) { `process.stderr.write(string)` } STDOUT.tty = true STDERR.tty = true
Version data entries
13 entries across 13 versions & 1 rubygems