forked from aniani/vim
patch 9.0.0803: readblob() cannot read from character device
Problem: readblob() cannot read from character device. Solution: Use S_ISCHR() to not check the size. (Ken Takata, closes #11407)
This commit is contained in:
@@ -6859,7 +6859,12 @@ readblob({fname} [, {offset} [, {size}]]) *readblob()*
|
||||
readblob('file.bin', 0, 100)
|
||||
< If {size} is -1 or omitted, the whole data starting from
|
||||
{offset} will be read.
|
||||
When the file can't be opened an error message is given and
|
||||
This can be also used to read the data from a character device
|
||||
on Unix when {size} is explicitly set. Only if the device
|
||||
supports seeking {offset} can be used. Otherwise it should be
|
||||
zero. E.g. to read 10 bytes from a serial console: >
|
||||
readblob('/dev/ttyS0', 0, 10)
|
||||
< When the file can't be opened an error message is given and
|
||||
the result is an empty |Blob|.
|
||||
When trying to read bytes beyond the end of the file the
|
||||
result is an empty blob.
|
||||
|
||||
Reference in New Issue
Block a user