mirror of
https://github.com/siemens-mobile-hacks/node-serialport-bindings-cpp.git
synced 2026-11-26 02:47:17 +00:00
fix: unix reading (#1953)
Another casualty of the async function refactor. This did fail the arudino tests.
This commit is contained in:
parent
bfb47c71da
commit
c7ca08f03a
2 changed files with 3 additions and 3 deletions
|
|
@ -347,7 +347,7 @@ function testBinding(bindingName, Binding, testPort) {
|
|||
noZalgo = true
|
||||
})
|
||||
|
||||
it('throws when not given a buffer', async () => {
|
||||
it('rejects when not given a buffer', async () => {
|
||||
const binding = new Binding({
|
||||
disconnect,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@ module.exports = async function unixRead(buffer, offset, length) {
|
|||
}
|
||||
|
||||
try {
|
||||
const bytesRead = await readAsync(this.fd, buffer, offset, length, null)
|
||||
const { bytesRead } = await readAsync(this.fd, buffer, offset, length, null)
|
||||
if (bytesRead === 0) {
|
||||
return this.read(buffer, offset, length)
|
||||
}
|
||||
|
||||
logger('Finished read', bytesRead, 'bytes')
|
||||
return bytesRead
|
||||
return { bytesRead, buffer }
|
||||
} catch (err) {
|
||||
if (err.code === 'EAGAIN' || err.code === 'EWOULDBLOCK' || err.code === 'EINTR') {
|
||||
if (!this.isOpen) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue