Skip to content

Commit 07e043b

Browse files
committed
Fixed problem with FrameworkImage.save() and CLEANUP().
1 parent deb7b2b commit 07e043b

3 files changed

Lines changed: 8 additions & 26 deletions

File tree

changes.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
- fixed: `F.websocket()` input arguments by @claudioquaglia
55
- fixed: Schema parsing
66
- fixed: view looping
7+
- fixed: `FrameworkImage.save()` problem with streams
8+
- fixed: `CLEANUP(stream)` method
79

810
======= 1.9.7
911

image.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
/**
2323
* @module FrameworkImage
24-
* @version 1.9.7
24+
* @version 1.9.8
2525
*/
2626

2727
'use strict';
@@ -234,10 +234,6 @@ Image.prototype.save = function(filename, callback, writer) {
234234

235235
var cmd = exec(command, function(error, stdout, stderr) {
236236

237-
FINISHED(stdout, function() {
238-
DESTROY(stdout);
239-
});
240-
241237
// clean up
242238
cmd.kill();
243239
cmd = null;
@@ -274,9 +270,7 @@ Image.prototype.save = function(filename, callback, writer) {
274270
self.currentStream.pipe(cmd.stdin);
275271
}
276272

277-
FINISHED(cmd.stdin, function() {
278-
DESTROY(cmd.stdin);
279-
});
273+
CLEANUP(cmd.stdin);
280274

281275
if (writer)
282276
writer(cmd.stdin);

index.js

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -336,24 +336,10 @@ global.CLEANUP = function(stream, callback) {
336336
});
337337
};
338338

339-
if (stream.readable) {
340-
if (stream.path) {
341-
stream.on('end', fn);
342-
return;
343-
}
344-
} else {
345-
if (stream.path) {
346-
stream.on('finish', fn);
347-
return;
348-
}
349-
}
350-
351-
fn = null;
352-
FINISHED(stream, function() {
353-
if (callback)
354-
callback();
355-
DESTROY(stream);
356-
});
339+
if (stream.readable)
340+
stream.on('end', fn);
341+
else
342+
stream.on('finish', fn);
357343
};
358344

359345
global.SUCCESS = function(success, value) {

0 commit comments

Comments
 (0)