Skip to content

"WriteStream.close" from "fs" module not executing the callback #2950

Closed
@gkubisa

Description

@gkubisa

The callback passed to WriteStream.close function from the "fs" module is not called in certain situations (see below). The same applies to the ReadStream.

var fs = require('fs');
var a = fs.createWriteStream('/tmp/aaa');

a.close(console.log.bind(null, 'closed'));
// prints "closed"

a.close(console.log.bind(null, 'closed'));
// the "close" callback is not executed the second time
var fs = require('fs');
var a = fs.createWriteStream('/dev/full');

a.on('error', console.log.bind(null, 'error'));
a.write('a');
// prints "error"

a.close(console.log.bind(null, 'closed'));
// the "close" callback is not called after an error

Metadata

Metadata

Assignees

No one assigned

    Labels

    fsIssues and PRs related to the fs subsystem / file system.streamIssues and PRs related to the stream subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions