aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/src
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2010-06-01 16:51:34 +0200
committerPatrik Nyblom <[email protected]>2010-06-01 16:51:34 +0200
commit4e09d1966e70a75d6babf2fb7ee910d2686f2d97 (patch)
tree580782d48663af84ae425a5c404215fc68c0ad8c /lib/kernel/src
parent256fb889b337781d27642471f16a5c7e0a988d8c (diff)
downloadotp-4e09d1966e70a75d6babf2fb7ee910d2686f2d97.tar.gz
otp-4e09d1966e70a75d6babf2fb7ee910d2686f2d97.tar.bz2
otp-4e09d1966e70a75d6babf2fb7ee910d2686f2d97.zip
Teach file:write/read/read_line about named io_servers
Diffstat (limited to 'lib/kernel/src')
-rw-r--r--lib/kernel/src/file.erl6
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});