diff options
author | Erlang/OTP <[email protected]> | 2010-06-03 09:13:34 +0000 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2010-06-03 09:13:34 +0000 |
commit | 6c6ed6c36e41e34cb360fdeca6556eb4efa4d237 (patch) | |
tree | 1d0c635e7da3b73e0762dd8d2ebdf2d45b5eb674 /lib/kernel/src | |
parent | fe22c51ffb9d71ca11d4bac71e1fcc82b6b6d977 (diff) | |
parent | 4e09d1966e70a75d6babf2fb7ee910d2686f2d97 (diff) | |
download | otp-6c6ed6c36e41e34cb360fdeca6556eb4efa4d237.tar.gz otp-6c6ed6c36e41e34cb360fdeca6556eb4efa4d237.tar.bz2 otp-6c6ed6c36e41e34cb360fdeca6556eb4efa4d237.zip |
Merge branch 'pan/otp_8611_standard_io' into dev
* pan/otp_8611_standard_io:
Teach file:write/read/read_line about named io_servers
OTP-8611 file:write,read and read_line on named io_device()
The file module's functions write,read and read_line now handles named
io_servers like 'standard_io' and 'standard_error' correctly.
Diffstat (limited to 'lib/kernel/src')
-rw-r--r-- | lib/kernel/src/file.erl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/kernel/src/file.erl b/lib/kernel/src/file.erl index a694ed0708..a37614e424 100644 --- a/lib/kernel/src/file.erl +++ b/lib/kernel/src/file.erl @@ -369,7 +369,7 @@ advise(_, _, _, _) -> -spec read(File :: io_device(), Size :: non_neg_integer()) -> 'eof' | {'ok', [char()] | binary()} | {'error', posix()}. -read(File, Sz) when is_pid(File), is_integer(Sz), Sz >= 0 -> +read(File, Sz) when (is_pid(File) orelse is_atom(File)), is_integer(Sz), Sz >= 0 -> case io:request(File, {get_chars, '', Sz}) of Data when is_list(Data); is_binary(Data) -> {ok, Data}; @@ -385,7 +385,7 @@ read(_, _) -> -spec read_line(File :: io_device()) -> 'eof' | {'ok', [char()] | binary()} | {'error', posix()}. -read_line(File) when is_pid(File) -> +read_line(File) when (is_pid(File) orelse is_atom(File)) -> case io:request(File, {get_line, ''}) of Data when is_list(Data); is_binary(Data) -> {ok, Data}; @@ -439,7 +439,7 @@ pread(_, _, _) -> -spec write(File :: io_device(), Byte :: iodata()) -> 'ok' | {'error', posix()}. -write(File, Bytes) when is_pid(File) -> +write(File, Bytes) when (is_pid(File) orelse is_atom(File)) -> case make_binary(Bytes) of Bin when is_binary(Bin) -> io:request(File, {put_chars,Bin}); |