vercel / pkg

Package your Node.js project into an executable
https://npmjs.com/pkg
MIT License
24.28k stars 1.01k forks source link

Do not remove temporary folder if it doesn't exist #2026

Closed sebbo2002 closed 8 months ago

sebbo2002 commented 9 months ago

When executing binaries created with pkg, I also occasionally encountered the error described in #1778, for example:

Error: ENOENT: no such file or directory, stat '/var/folders/q3/7_wg79yj5mg14320hlz4sqr00000gn/T/pkg-bnLwAL'
    at Object.statSync (node:fs:1596:3)
    at Object.statSync (pkg/prelude/bootstrap.js:1476:32)
    at __node_internal_ (node:internal/fs/utils:801:8)
    at Object.rmSync (node:fs:1271:13)
    at removeTemporaryFolderAndContent (pkg/prelude/bootstrap.js:704:10)
    at process.<anonymous> (pkg/prelude/bootstrap.js:711:5)
    at process.emit (node:events:549:35)
    at process.emit (node:domain:482:12)

Unfortunately irregular and not reproducible. I would therefore like to add this line so that the temporary folder is not deleted in the first place if it does not exist.

austen-herbst commented 8 months ago

@leerob Would it be possible to get this change in a release? We are facing the same issue as @sebbo2002 (described in #1778) and would like to take advantage of this fix.