Skip to content

Commit

Permalink
apply the fix not only for win32
Browse files Browse the repository at this point in the history
  • Loading branch information
gdavidkov committed Nov 6, 2024
1 parent 9776220 commit 94dec01
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tools/updatenan.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
const spawn = require('child_process').spawn
const existsSync = require('fs').existsSync

const nanPath = existsSync('./node_modules/nan/nan.h') ? './node_modules/nan/nan.h' : '../nan/nan.h'
if (process.platform === 'win32') {
const nanPath = existsSync('./node_modules/nan/nan.h') ? './node_modules/nan/nan.h' : '../nan/nan.h'
spawn('powershell', ['-Command', `(Get-Content -Raw ${nanPath}) -replace '#include \"nan_scriptorigin.h\"', '// #include \"nan_scriptorigin.h\"' | Out-File -Encoding Utf8 ${nanPath}`], { stdio: 'inherit' })
} else {
spawn('sed', ['-i', '-e', 's/^#include .nan_scriptorigin\\.h./\\/\\/ #include nan_scriptorigin.h/', './node_modules/nan/nan.h'], { stdio: 'inherit' })
spawn('sed', ['-i', '-e', 's/^#include .nan_scriptorigin\\.h./\\/\\/ #include nan_scriptorigin.h/', nanPath], { stdio: 'inherit' })
}

0 comments on commit 94dec01

Please sign in to comment.