@@ -2164,7 +2164,7 @@ FsReadStream.prototype.open = function() {
2164
2164
this . _vol . open ( this . path , this . flags , this . mode , function ( er , fd ) {
2165
2165
if ( er ) {
2166
2166
if ( self . autoClose ) {
2167
- self . destroy ( ) ;
2167
+ if ( self . destroy ) self . destroy ( ) ;
2168
2168
}
2169
2169
self . emit ( 'error' , er ) ;
2170
2170
return ;
@@ -2218,7 +2218,7 @@ FsReadStream.prototype._read = function(n) {
2218
2218
2219
2219
function onread ( er , bytesRead ) {
2220
2220
if ( er ) {
2221
- if ( self . autoClose ) {
2221
+ if ( self . autoClose && self . destroy ) {
2222
2222
self . destroy ( ) ;
2223
2223
}
2224
2224
self . emit ( 'error' , er ) ;
@@ -2334,7 +2334,7 @@ function FsWriteStream(vol, path, options) {
2334
2334
FsWriteStream . prototype . open = function ( ) {
2335
2335
this . _vol . open ( this . path , this . flags , this . mode , function ( er , fd ) {
2336
2336
if ( er ) {
2337
- if ( this . autoClose ) {
2337
+ if ( this . autoClose && this . destroy ) {
2338
2338
this . destroy ( ) ;
2339
2339
}
2340
2340
this . emit ( 'error' , er ) ;
@@ -2359,7 +2359,7 @@ FsWriteStream.prototype._write = function(data, encoding, cb) {
2359
2359
var self = this ;
2360
2360
this . _vol . write ( this . fd , data , 0 , data . length , this . pos , function ( er , bytes ) {
2361
2361
if ( er ) {
2362
- if ( self . autoClose ) {
2362
+ if ( self . autoClose && self . destroy ) {
2363
2363
self . destroy ( ) ;
2364
2364
}
2365
2365
return cb ( er ) ;
@@ -2394,7 +2394,7 @@ FsWriteStream.prototype._writev = function(data, cb) {
2394
2394
const buf = Buffer . concat ( chunks ) ;
2395
2395
this . _vol . write ( this . fd , buf , 0 , buf . length , this . pos , ( er , bytes ) => {
2396
2396
if ( er ) {
2397
- self . destroy ( ) ;
2397
+ if ( self . destroy ) self . destroy ( ) ;
2398
2398
return cb ( er ) ;
2399
2399
}
2400
2400
self . bytesWritten += bytes ;
0 commit comments