Commit graph

1805 commits

Author SHA1 Message Date
Burdette Lamar
e40f79daa3
Enhanced RDoc for io.c (#5444)
Treated:

    IO#open
    IO#sysopen
    #open
    IO#putc
    IO#puts
    #p
    Kernel#display
2022-01-14 18:33:06 -06:00
Burdette Lamar
6dc4c942a3
File rdoc (#5438)
Treats:

    File introduction
    File.open
    File.new
2022-01-13 18:00:24 -06:00
Burdette Lamar
faf79d3a25
Enhanced RDoc for IO.popen (#5430)
* Enhanced RDoc for IO.popen
2022-01-12 17:08:30 -06:00
Burdette Lamar
d920535d1b
Enhanced RDoc for IO (#5425)
Treats:

    #pread
    #pwrite
    #binmode
    #binmode?
2022-01-10 17:02:48 -06:00
Burdette Lamar
6931d70e6e
Enhanced RDoc for IO (#5424)
Treats:

    #sysseek
    #syswrite
    #sysread
2022-01-10 15:14:36 -06:00
Burdette Lamar
a9dc0c59e3
[DOC] Enhanced RDoc for IO (#5422)
Revises much of the introductory material.

Also treats:

    #close_on_exec
    #close
    #closed?
    #close_read
    #close_write
2022-01-10 12:45:06 -06:00
Samuel Williams
0ca00e2cb7
Move IO write buffer allocation into function. 2022-01-09 00:03:16 +13:00
Burdette Lamar
5ad507d751
Enhanced RDoc for IO (#5402)
Treats:

    #ungetc
    #isatty
    #close_on_exec?
2022-01-06 10:47:51 -06:00
Burdette Lamar
445c055b44
Enhanced RDoc for IO (#5395)
Treats:

    #getc
    #readchar
    #getbyte
    #readbyte
    #ungetbyte
2022-01-05 16:13:06 -06:00
Burdette Lamar
9c15da0fd4
Enhanced RDoc for IO (#5381)
Treats:

    #lineno
    #lineno=
    #readline
    #readlines
    #each_line
    #each_byte
    #each_char
    #each_codepoint
2022-01-04 12:57:45 -06:00
Nobuyoshi Nakada
069cca6f74
Negative RBOOL usage 2022-01-01 17:02:04 +09:00
Samuel Williams
243320d22f
Fix incorrect minimum read length. (#5353) 2022-01-01 20:23:47 +13:00
Burdette Lamar
87c03694e6
Enhanced RDoc for IO (#5367)
Adds sections to class RDoc:

    Lines
        Line Separator
        Line Limit
        Line Number

Revises example text file t.txt to:

    Include paragraphs (separated by double line separator).
    Avoid being too long.

Revises examples that use the changed example file.

There are several other methods that will point to the added sections.
2021-12-30 16:46:24 -06:00
Nobuyoshi Nakada
3238164f9c ioctl_narg_len is used only when ioctl(2) is available 2021-12-29 11:40:04 +09:00
Samuel Williams
548c8f5f7a
Prefer to use RTEST when checking result of rb_io_wait. (#5341)
* Prefer to use RTEST when checking result of `rb_io_wait`.

* Consistently use false for signifying no events ready.
2021-12-25 02:26:06 +13:00
Nobuyoshi Nakada
4f74153846
Adjust styles [ci skip] 2021-12-24 21:17:27 +09:00
Samuel Williams
acfe2f2655
Improvements to rb_io_wait return value handling and internal implementation. (#5340) 2021-12-24 23:11:02 +13:00
Burdette Lamar
a8f4cc2bfa
[DOC] Enhanced RDoc for IO (#5324)
Treats #gets.
2021-12-23 10:27:10 -06:00
Burdette Lamar
243ecd176d
[DOC] Enhanced RDoc for IO (#5321)
Treats:

    #readpartial
    #read
2021-12-22 14:41:39 -06:00
Nobuyoshi Nakada
fdf3996349
Empty and return the buffer if zero size is given [Bug #18421]
In `IO#readpartial` and `IO#read_nonblock`, as well as `IO#read`.
2021-12-22 15:45:59 +09:00
Nobuyoshi Nakada
c29c2afafe Refactor setup_narg and extract finish_narg 2021-12-21 13:34:04 +09:00
Burdette Lamar
6ad8cf7071
[DOC] Enhanced RDoc for IO (#5307)
Treated:

    #sync
    #sync=
    #fsync
    #fdatasync
    #fileno
    #pid
    #inspect
    #to_io
2021-12-20 16:28:58 -06:00
Burdette Lamar
3bb6e4f641
[DOC] Enhanced RDoc for IO (#5304)
Treated:

    ::try_convert
    #write
    #<<
    #flush
    #tell
    #seek
    #pos=
    #rewind
    #eof
2021-12-19 22:04:47 -06:00
Burdette Lamar
f44367effe
[DOC] Addition to IO introduction (#5299)
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2021-12-19 09:37:06 -06:00
Samuel Williams
42d3231154
Introduce io_result wrapper for passing [-errno, size] in VALUE. 2021-12-18 18:19:30 +13:00
Nobuyoshi Nakada
b555e659c4
Do not use fcopyfile if appending to non-empty file [Bug #18388]
`fcopyfile` appends `src` to `to` and then truncates `to` to it's
original size.
2021-12-05 18:47:02 +09:00
Nobuyoshi Nakada
37cd35aea8 [win32] Transcode input from console [Bug #18353]
On Windows, as the input from console is encoded in the active
code page, convert the input to the internal encoding.
2021-12-01 18:54:26 +09:00
Samuel Williams
51c67ee61a Don't allow fd == -1 to propagate to system calls. 2021-11-11 13:35:16 +13:00
Nobuyoshi Nakada
46e46eafd4
size_t is not for file size 2021-11-10 16:41:26 +09:00
Samuel Williams
4b89034218 IO::Buffer for scheduler interface. 2021-11-10 19:21:05 +13:00
Peter Zhu
aeae6e2842 [Feature #18290] Remove all usages of rb_gc_force_recycle
This commit removes usages of rb_gc_force_recycle since it is a burden
to maintain and makes changes to the GC difficult.
2021-11-08 14:05:54 -05:00
Nobuyoshi Nakada
049e1f8560
Fix typo 2021-10-26 14:43:12 +09:00
Yusuke Endoh
13068ebe32
process.c: Add Process._fork (#5017)
* process.c: Add Process._fork

This API is supposed for application monitoring libraries to hook fork
event.

[Feature #17795]

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2021-10-25 20:47:19 +09:00
Nobuyoshi Nakada
408605aae7 EWOULDBLOCK is always defined since 74ba9c2488 2021-10-24 19:24:50 +09:00
Nobuyoshi Nakada
3d7c92df08 Extract io_again_p to check if EAGAIN or EWOULDBLOCK 2021-10-24 19:24:50 +09:00
Nobuyoshi Nakada
9822ebee5b suppress warnings by parenthesizing unclear expressions 2021-10-24 19:24:50 +09:00
Nobuyoshi Nakada
606e785fa8
Reuse ractor stderr 2021-10-07 19:57:09 +09:00
Nobuyoshi Nakada
a706c09fa6
Adjust styles [ci skip] 2021-10-07 19:57:09 +09:00
S.H
dc9112cf10
Using NIL_P macro instead of == Qnil 2021-10-03 22:34:45 +09:00
Kazuhiro NISHIYAMA
e0c6e8c64a
[DOC] Use unpack1 instead of unpack(template)[0] [ci skip] 2021-09-23 09:20:00 +09:00
S-H-GAMELINKS
032534dbdf Using RB_BIGNUM_TYPE_P macro 2021-09-11 09:13:24 +09:00
Lars Kanis
6594623f62 Fix Marshal.dump(closed_io) to raise TypeError and allow encoding on closed IO
Mashalling a closed IO object raised "closed stream (IOError)" before instead of TypeError.
This changes IO#(in|ex)ternal_encoding to still return the encoding even if the underlying FD is closed.

Fixes bug #18077
2021-08-22 10:33:22 +09:00
Nobuyoshi Nakada
a8714b83c4
popen() is not available on emscripten 2021-08-16 17:00:19 +09:00
Csaba Henk
8df1ace64a Fix ARGF.read(length) short read [Bug #18074] 2021-08-10 11:32:45 +09:00
Samuel Williams
3a8cadcf8f Reduce chance to receive EBADF when closing an IO from another thread. 2021-08-08 22:12:14 +12:00
S.H
378e8cdad6
Using RBOOL macro 2021-08-02 12:06:44 +09:00
Nobuyoshi Nakada
3b52230452
Define functions using rb_wait_for_single_fd [Bug #18046] 2021-08-01 06:49:07 +09:00
Yusuke Endoh
eee709595c io.c: Clarify the behavior of IO.read when called as File.read
Ditto to `IO.binread`, `IO.write`, `IO.binwrite`, `IO.foreach`, and
`IO.readlines`.
2021-07-16 16:10:54 +09:00
Yusuke Endoh
645616c273 process.c: Call rb_thread_atfork in rb_fork_ruby
All occurrences of rb_fork_ruby are followed by a call rb_thread_fork in
the created child process.

This is refactoring and a potential preparation for [Feature #17795].
(rb_fork_ruby may be wrapped by Process._fork_.)
2021-07-15 16:46:08 +09:00
Nobuyoshi Nakada
59ead88563
[DOC] add notes and examples for pipe [ci skip] 2021-06-30 15:45:21 +09:00