mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Fix
This commit is contained in:
@@ -200,8 +200,10 @@ function asyncWrap(fn: any, name: string) {
|
||||
const wrapped = async function (...args) {
|
||||
return fn.$apply(fs, args);
|
||||
};
|
||||
Object.defineProperty(wrapped, "name", { value: name });
|
||||
Object.defineProperty(wrapped, "length", { value: fn.length });
|
||||
const descriptor = { value: name, enumerable: false, configurable: true };
|
||||
Object.$defineProperty(wrapped, "name", descriptor);
|
||||
Object.$defineProperty(wrapped, "displayName", descriptor);
|
||||
Object.$defineProperty(wrapped, "length", { value: fn.length });
|
||||
return wrapped;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ const EventEmitter = require("node:events");
|
||||
|
||||
const types = require("node:util/types");
|
||||
const { validateFunction, validateInteger } = require("internal/validators");
|
||||
const { kEmptyObject } = require("internal/shared");
|
||||
const { kEmptyObject, kFd } = require("internal/shared");
|
||||
const fs = require("internal/fs/binding");
|
||||
|
||||
const isDate = types.isDate;
|
||||
@@ -1273,6 +1273,7 @@ var exports = {
|
||||
value: promises,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
});
|
||||
return promises;
|
||||
},
|
||||
@@ -1281,6 +1282,7 @@ var exports = {
|
||||
value,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
});
|
||||
},
|
||||
};
|
||||
@@ -1288,7 +1290,9 @@ export default exports;
|
||||
|
||||
// Preserve the names
|
||||
function setName(fn, value) {
|
||||
Object.$defineProperty(fn, "name", { value, enumerable: false, configurable: true });
|
||||
const descriptor = { value, enumerable: false, configurable: true };
|
||||
Object.$defineProperty(fn, "name", descriptor);
|
||||
Object.$defineProperty(fn, "displayName", descriptor);
|
||||
}
|
||||
setName(Dirent, "Dirent");
|
||||
setName(FSWatcher, "FSWatcher");
|
||||
|
||||
@@ -25,12 +25,11 @@
|
||||
* Modifications were made to the original code.
|
||||
*/
|
||||
const { isTypedArray } = require("node:util/types");
|
||||
const { hideFromStack, throwNotImplemented } = require("internal/shared");
|
||||
const { hideFromStack, kFd } = require("internal/shared");
|
||||
const { STATUS_CODES } = require("internal/http");
|
||||
const tls = require("node:tls");
|
||||
const net = require("node:net");
|
||||
const fs = require("node:fs");
|
||||
const { FileHandle } = require("internal/fs/FileHandle");
|
||||
const bunTLSConnectOptions = Symbol.for("::buntlsconnectoptions::");
|
||||
const bunSocketServerOptions = Symbol.for("::bunnetserveroptions::");
|
||||
const kInfoHeaders = Symbol("sent-info-headers");
|
||||
@@ -2167,8 +2166,8 @@ class ServerHttp2Stream extends Http2Stream {
|
||||
if (options.statCheck !== undefined && typeof options.statCheck !== "function") {
|
||||
throw $ERR_INVALID_ARG_VALUE("options.statCheck", options.statCheck);
|
||||
}
|
||||
if (fd instanceof FileHandle) {
|
||||
fs.fstat(fd.fd, doSendFileFD.bind(this, options, fd, headers));
|
||||
if (fd?.[kFd]) {
|
||||
fs.fstat(fd?.[kFd], doSendFileFD.bind(this, options, fd, headers));
|
||||
} else {
|
||||
fs.fstat(fd, doSendFileFD.bind(this, options, fd, headers));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user