| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3797625 commit 05d1a53
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -39,12 +39,11 @@ const noop = () => {}; | |||
| 39 | 39 | const hasCrypto = Boolean(process.versions.openssl); | |
| 40 | 40 | ||
| 41 | 41 | const isMainThread = (() => { | |
| 42 | - try { | ||
| 42 | + if (require('module').builtinModules.includes('worker_threads')) { | ||
| 43 | 43 | return require('worker_threads').isMainThread; | |
| 44 | - } catch { | ||
| 45 | - // Worker module not enabled → only a single main thread exists. | ||
| 46 | - return true; | ||
| 47 | 44 | } | |
| 45 | + // Worker module not enabled → only a single main thread exists. | ||
| 46 | + return true; | ||
| 48 | 47 | })(); | |
| 49 | 48 | ||
| 50 | 49 | // Check for flags. Skip this for workers (both, the `cluster` module and | |
| Back | FazBrowse Home | New Git URL |
0 commit comments