mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-28 05:36:34 +00:00
fix(image-stream): destroy unused image streams (#1211)
When fetching metadata, a stream is opened, but never consumed. This destroys the stream when retrieving metadata to avoid dangling open file descriptors and such. Change-Type: patch Changelog-Entry: Fix unmounting freezing in macOS. Fixes: https://github.com/resin-io/etcher/issues/985
This commit is contained in:
parent
198ddb7433
commit
3d68688f33
@ -108,6 +108,11 @@ exports.getFromFilePath = (file) => {
|
|||||||
*/
|
*/
|
||||||
exports.getImageMetadata = (file) => {
|
exports.getImageMetadata = (file) => {
|
||||||
return exports.getFromFilePath(file).then((image) => {
|
return exports.getFromFilePath(file).then((image) => {
|
||||||
|
|
||||||
|
// Since we're not consuming this stream,
|
||||||
|
// destroy() it, to avoid dangling open file descriptors etc.
|
||||||
|
image.stream.destroy();
|
||||||
|
|
||||||
return _.omitBy(image, isStream);
|
return _.omitBy(image, isStream);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user