Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.

Commit d80531e

Browse files
committed
dezalgo(maybeCallback(arguments)) for writeToSnapshot
1 parent 5119d84 commit d80531e

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

prelude/bootstrap.js

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -673,8 +673,9 @@ var modifyNativeAddonWin32 = (function () {
673673
// write /////////////////////////////////////////////////////////
674674
// ///////////////////////////////////////////////////////////////
675675

676-
function writeToSnapshot () {
677-
throw new Error('Cannot write to packaged file');
676+
function writeToSnapshot (cb) {
677+
var cb2 = cb || rethrow;
678+
return cb2(new Error('Cannot write to packaged file'));
678679
}
679680

680681
fs.writeSync = function (fd) {
@@ -690,17 +691,8 @@ var modifyNativeAddonWin32 = (function () {
690691
return ancestor.write.apply(fs, arguments);
691692
}
692693

693-
var callback = maybeCallback(arguments);
694-
try {
695-
var r = writeToSnapshot();
696-
process.nextTick(function () {
697-
callback(null, r, buffer);
698-
});
699-
} catch (error) {
700-
process.nextTick(function () {
701-
callback(error);
702-
});
703-
}
694+
var callback = dezalgo(maybeCallback(arguments));
695+
writeToSnapshot(callback);
704696
};
705697

706698
// ///////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)