We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent daa1c86 commit e520087Copy full SHA for e520087
src/node/http.ts
@@ -578,11 +578,18 @@ export class HttpServer {
578
*/
579
public listen(): Promise<string | null> {
580
if (!this.listenPromise) {
581
- this.listenPromise = new Promise((resolve, reject) => {
+ this.listenPromise = new Promise(async (resolve, reject) => {
582
this.server.on("error", reject)
583
this.server.on("upgrade", this.onUpgrade)
584
const onListen = (): void => resolve(this.address())
585
if (this.options.socket) {
586
+ try {
587
+ await fs.unlink(this.options.socket)
588
+ } catch (err) {
589
+ if (err.code !== "ENOENT") {
590
+ logger.warn(err.message)
591
+ }
592
593
this.server.listen(this.options.socket, onListen)
594
} else if (this.options.host) {
595
// [] is the correct format when using :: but Node errors with them.
0 commit comments