Skip to content

Commit 1ac4daf

Browse files
authored
Update bindings.js
Attempt to address TooTallNate#50 (comment) and TooTallNate#61
1 parent c8033dc commit 1ac4daf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

bindings.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,13 @@ exports.getFileName = function getFileName(calling_file) {
169169

170170
// run the 'prepareStackTrace' function above
171171
Error.captureStackTrace(dummy);
172-
dummy.stack;
172+
noop(dummy.stack); // https://github.com/TooTallNate/node-bindings/issues/61
173173

174174
// cleanup
175175
Error.prepareStackTrace = origPST;
176176
Error.stackTraceLimit = origSTL;
177+
178+
if(!fileName) return ""; // https://github.com/TooTallNate/node-bindings/issues/50#issuecomment-864171923
177179

178180
// handle filename that starts with "file://"
179181
var fileSchema = 'file://';
@@ -184,6 +186,10 @@ exports.getFileName = function getFileName(calling_file) {
184186
return fileName;
185187
};
186188

189+
function noop(input) {
190+
return input;
191+
}
192+
187193
/**
188194
* Gets the root directory of a module, given an arbitrary filename
189195
* somewhere in the module tree. The "root directory" is the directory

0 commit comments

Comments
 (0)