Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,22 @@ var proc = require('child_process')
var os = require('os')
var path = require('path')

var targetMismatch = (process.env.npm_config_platform && process.platform !== process.env.npm_config_platform) ||
(process.env.npm_config_arch && process.arch !== process.env.npm_config_arch)

if (!buildFromSource()) {
proc.exec('node-gyp-build-test', function (err, stdout, stderr) {
if (err) {
if (verbose()) console.error(stderr)
preinstall()
}
})
if (targetMismatch) {
// If the target is mismatched, then we can't test built output, and we can't build from source either.
// Instead, we just check whether a matching prebuild exists, and fail if it doesn't.
require('./index').path(process.cwd())
} else {
proc.exec('node-gyp-build-test', function (err, stdout, stderr) {
if (err) {
if (verbose()) console.error(stderr)
preinstall()
}
})
}
} else {
preinstall()
}
Expand Down