Skip to content

Commit 8790860

Browse files
committed
fix: auto-inject openssl-legacy-provider if bf-cbc is missing
1 parent ab50a6c commit 8790860

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/index.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
import { spawnSync } from 'node:child_process'
2+
import crypto from 'node:crypto'
3+
4+
if (!crypto.getCiphers().includes('bf-cbc') && !process.env._NL_REEXEC_OSSL) {
5+
const env = {
6+
...process.env,
7+
_NL_REEXEC_OSSL: '1'
8+
}
9+
10+
const args = [
11+
'--openssl-legacy-provider',
12+
...process.execArgv,
13+
...process.argv.slice(1)
14+
]
15+
16+
const r = spawnSync(process.execPath, args, { stdio: 'inherit', env })
17+
process.exit(r.status ?? 1)
18+
}
19+
120
import cluster from 'node:cluster'
221
import { EventEmitter } from 'node:events'
322
import http from 'node:http'

0 commit comments

Comments
 (0)