[FSPersistorManager] fix the stream opening for node10+

Attaching a `readable` listener causes the stream to hang otherwise.

Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
This commit is contained in:
Jakob Ackermann 2019-05-02 02:04:59 +02:00 committed by Simon Detheridge
parent 330ba41dd6
commit c5e1584fcc

View file

@ -48,10 +48,10 @@ module.exports =
fs.open "#{location}/#{filteredName}", 'r', (err, fd) -> fs.open "#{location}/#{filteredName}", 'r', (err, fd) ->
if err? if err?
logger.err err:err, location:location, filteredName:name, "Error reading from file" logger.err err:err, location:location, filteredName:name, "Error reading from file"
if err.code == 'ENOENT' if err.code == 'ENOENT'
return callback new Errors.NotFoundError(err.message), null return callback new Errors.NotFoundError(err.message), null
else else
return callback err, null return callback err, null
opts.fd = fd opts.fd = fd
sourceStream = fs.createReadStream null, opts sourceStream = fs.createReadStream null, opts
return callback null, sourceStream return callback null, sourceStream