summaryrefslogtreecommitdiff
path: root/io.c
AgeCommit message (Collapse)Author
2023-01-01Make IO#set_encoding with binary external encoding use nil internal encodingJeremy Evans
This was already the behavior when a single `'external:internal'` encoding specifier string was passed. This makes the behavior consistent for the case where separate external and internal encoding specifiers are provided. While here, fix the IO#set_encoding method documentation to state that either the first or second argument can be a string with an encoding name, and describe the behavior when the external encoding is binary. Fixes [Bug #18899] Notes: Merged: https://github.com/ruby/ruby/pull/6280
2022-12-23Docs: path: option for IO.newzverok
Notes: Merged: https://github.com/ruby/ruby/pull/6985
2022-12-22[DOC] IO#read doesn't always read in binary modeAlan Wu
When `maxlen` is `nil`, it uses the data mode of the stream. For example in the following: ```ruby File.binwrite("a.txt", "\r\n\r") p File.open("a.txt", "rt").read # "\n\n" p File.open("a.txt", "rt").read(3) # "\r\n\r" ``` Note, this newline translation is _not_ specific to Windows. Notes: Merged: https://github.com/ruby/ruby/pull/6982 Merged-By: XrXr
2022-12-08Introduce `IO.new(..., path:)` and promote `File#path` to `IO#path`. (#6867)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-12-02io.c (read_all): grow the buffer exponentially when size is unknownJean Boussier
[Feature #6047] Currently it's grown by `BUFSIZ` (1024) on every iteration which is bit wasteful. Instead we can double the capacity whenever there is less than `BUFSIZ` capacity left. Notes: Merged: https://github.com/ruby/ruby/pull/6829
2022-12-02Introduce encoding check macroS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/6700
2022-12-02Introduce argf_encoding functionS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/6672
2022-12-02Reuse NIL_OR_UNDEF_P macroS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/6787
2022-11-16Using UNDEF_P macroS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/6721
2022-11-09[DOC] Enhanced RDoc for IO (#6669)Burdette Lamar
Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2022-10-29[DOC] Enhanced RDOc for IO (#6642)Burdette Lamar
In io.c treats: #close #close_read #close_write #closed Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2022-10-15Update `Fiber::Scheduler` documentation. (#6562)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-10-15Introduce `Fiber::Scheduler#io_select` hook for non-blocking `IO.select`. ↵Samuel Williams
(#6559) Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-10-15Copy `IO#timeout` on `IO#dup`. (#6546)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-10-11Ignore failure to set nonblock mode. (#6524)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-10-08Try `nil` as default for 'default timeout'. (#6509)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-10-07Add IO#timeout attribute and use it for blocking IO operations. (#5653)Samuel Williams
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-10-06[DOC] Integrate io_streams.rdoc into io.c (#6491)Burdette Lamar
Integrate io_streams.rdoc into io.c Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2022-10-02[DOC] RDoc changes for IO (#6458)Burdette Lamar
Moves Expect library doc into io.c. Changes certain links to local sections, now pointing to sections in doc/io_streams.rdoc. Removes local sections now superseded by sections in doc/io_streams.rdoc. Notes: Merged-By: BurdetteLamar <BurdetteLamar@Yahoo.com>
2022-09-16[ci skip] Fix typos in documentation in io.cPeter Zhu
2022-09-11[Win32] Negative length `IO#sysread`Jeremy Bopp
Raise `ArgumentError` in `IO#sysread` on Windows when given a negative length. Fixes [Bug #18880] Notes: Merged: https://github.com/ruby/ruby/pull/6354 Merged-By: nobu <nobu@ruby-lang.org>
2022-09-08[Bug #5317] Use `rb_off_t` instead of `off_t`Nobuyoshi Nakada
Get rid of the conflict with system-provided small `off_t`. Notes: Merged: https://github.com/ruby/ruby/pull/6329
2022-08-25Raise ArgumentError for IO.foreach with limit of 0Jeremy Evans
Makes behavior consistent with IO.readlines. Fixes [Bug #18767] Notes: Merged: https://github.com/ruby/ruby/pull/5954
2022-08-05[DOC] Mention Windows text mode EOF marker interpretationAlan Wu
I don't think this is super well known so it's worth mentioning as it can be a pitfall. See: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/fopen-wfopen?view=msvc-170 Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/6212
2022-08-05[DOC] Clarify that `IO.read` uses text modeAlan Wu
See: https://bugs.ruby-lang.org/issues/18882#note-13 [Bug #18882] Notes: Merged: https://github.com/ruby/ruby/pull/6212
2022-07-28[DOC] Cross references for `ARGF`Nobuyoshi Nakada
2022-07-27Fix documentation for ARGF.inplace_mode{,=}Jeremy Evans
The value affects the name of the backup file created, not the name of the file modified (as the file is modified in place). Fixes [Bug #18920]
2022-07-27Adjust styles [ci skip]Nobuyoshi Nakada
2022-07-23[DOC] IO#eofKaíque Kandy Koga
Use IO#eof? instead of I#eof? Notes: Merged: https://github.com/ruby/ruby/pull/6172
2022-07-21Do not chomp trailing line separator IO#each with nil separator and chompJeremy Evans
nil separator means no sepator, so chomp should not remove a line separator. Partially Fixes [Bug #18770] Notes: Merged: https://github.com/ruby/ruby/pull/6164
2022-07-21Expand tabs [ci skip]Takashi Kokubun
[Misc #18891] Notes: Merged: https://github.com/ruby/ruby/pull/6094
2022-07-21Revert "Do not chomp trailing line separator IO#each with nil separator and ↵Jeremy Evans
chomp" This reverts commit 04f86ad0b5d2fe4711ff300d855228a6aed55f33. This is causing CI issues, reverting for now.
2022-07-21Do not chomp trailing line separator IO#each with nil separator and chompJeremy Evans
nil separator means no sepator, so chomp should not remove a line separator. Partially Fixes [Bug #18770] Notes: Merged: https://github.com/ruby/ruby/pull/5959
2022-07-15[DOC] Fix documentation for ARGF#readlinesPeter Zhu
[Bug #18909] Notes: Merged: https://github.com/ruby/ruby/pull/6137
2022-07-14[DOC] Fix typo in documentation for IO#readlinesPeter Zhu
2022-07-07[Bug #18892] Reset `ARGF.lineno` after reading shebangNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6097
2022-07-06[Bug #18898] Fallback invalid external encoding to the defaultNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6093 Merged-By: nobu <nobu@ruby-lang.org>
2022-06-25Copy `IO#wait*` methods from `io-wait` gem to `io.c`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/6036
2022-06-20Allow to just warn as bool expected, without an exceptionNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6039
2022-06-17Using is_ascii_string to check encodingS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/5867
2022-06-13Handle case where write result is zero.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/6009
2022-06-09Stop ignoring 4th positional argument to IO.#{foreach,readlines}Jeremy Evans
Fixes [Bug #18771] Notes: Merged: https://github.com/ruby/ruby/pull/5953
2022-05-28Make `Kernel#p` completely uninterruptible.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5419
2022-05-28Tidy up usage of write_lock.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5419
2022-05-28Improve handling of zero length writes.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5419
2022-05-28Improve consistency of `io_binwritev_internal` implementaiton.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5419
2022-05-28Improve error handling in `finish_writeconv`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5419
2022-05-28Better handling of `error`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5419
2022-05-28Always allocate write_lockmachty
Notes: Merged: https://github.com/ruby/ruby/pull/5419
2022-05-28Make `io_binwritev` atomic.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/5419