Calling a JavaScript function wrapped as NativeCallback unexpectedly forces the current thread's error status to 0.
JavaScript code can make a change to the thread's error status by assigning to this.errno / this.lastError, and that works correctly. But if the script wishes instead to preserve the original value, it does not work as expected. Instead, the error status is forced to 0. Even if the script expressly sets this.errno / this.lastError to the original value, the error status gets set to 0 instead.
Calling a JavaScript function wrapped as NativeCallback unexpectedly forces the current thread's error status to 0.
JavaScript code can make a change to the thread's error status by assigning to
this.errno
/this.lastError
, and that works correctly. But if the script wishes instead to preserve the original value, it does not work as expected. Instead, the error status is forced to 0. Even if the script expressly setsthis.errno
/this.lastError
to the original value, the error status gets set to 0 instead.Example:
Expected output:
Actual output:
Uncommenting the line marked
[1]
produces these results:Related issue: #405 .