-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated node-pre-gyp attempting to resolve this issue, but it is still unresolved upstream. For now, hack in a patch. Once upstream fixes this, we can update to the fixed version and drop this hack. For more details, see mapbox/node-pre-gyp#715
- Loading branch information
Showing
3 changed files
with
249 additions
and
539 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Patch node-pre-gyp to work around unresolved issue on Windows | ||
// See https://github.com/mapbox/node-pre-gyp/issues/715 | ||
// Need to set shell: true on the spawn API on Windows now | ||
const fs = require('node:fs/promises'); | ||
|
||
const path = 'node_modules/@mapbox/node-pre-gyp/lib/util/compile.js'; | ||
|
||
const before = " const cmd = cp.spawn(shell_cmd, final_args, { cwd: undefined, env: process.env, stdio: [0, 1, 2] });"; | ||
const after = " const cmd = cp.spawn(shell_cmd, final_args, { cwd: undefined, env: process.env, stdio: [0, 1, 2], shell: process.platform === 'win32' });"; | ||
|
||
(async function script() { | ||
const fh = await fs.open(path, 'r+'); | ||
|
||
let i = 0; | ||
let out = ''; | ||
for await (let line of fh.readLines({autoClose: false})) { | ||
i++;; | ||
|
||
if (i == 80) { | ||
if (line != before) { | ||
console.error("Patch failed!\n"); | ||
process.exit(1); | ||
} | ||
line = after; | ||
} | ||
|
||
out += line + "\n"; | ||
} | ||
|
||
await fh.write(out, 0); | ||
|
||
await fh.close(); | ||
})(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.