This repository was archived by the owner on Feb 15, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed
Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -39,18 +39,18 @@ function cleanup (er) {
3939 } . bind ( this ) )
4040}
4141
42- function cleanupSync ( er ) {
42+ function cleanupSync ( ) {
4343 try {
4444 fs . unlinkSync ( this . __atomicTmp )
4545 } finally {
46- return fs . WriteStream . prototype . emit . call ( this , 'error' , er )
46+ return
4747 }
4848}
4949
5050// When we *would* emit 'close' or 'finish', instead do our stuff
5151WriteStream . prototype . emit = function ( ev ) {
5252 if ( ev === 'error' )
53- return cleanupSync ( this )
53+ cleanupSync . call ( this )
5454
5555 if ( ev !== 'close' && ev !== 'finish' )
5656 return fs . WriteStream . prototype . emit . apply ( this , arguments )
Original file line number Diff line number Diff line change 1+ var path = require ( 'path' )
2+ var test = require ( 'tap' ) . test
3+ var writeStream = require ( '../index.js' )
4+
5+ function repeat ( times , string ) {
6+ var output = ''
7+ for ( var ii = 0 ; ii < times ; ++ ii ) {
8+ output += string
9+ }
10+ return output
11+ }
12+
13+ var target = path . resolve ( __dirname , repeat ( 1000 , 'test' ) )
14+
15+ test ( 'name too long' , function ( t ) {
16+ var stream = writeStream ( target )
17+ stream . on ( 'error' , function ( er ) {
18+ t . is ( er . code , 'ENAMETOOLONG' , target . length + " character name results in ENAMETOOLONG" )
19+ } )
20+ stream . on ( 'close' , function ( ) {
21+ t . end ( )
22+ } )
23+ stream . end ( )
24+ } )
You can’t perform that action at this time.
0 commit comments