Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix spawn EINVAL error on Windows #84

Merged
merged 3 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
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
16 changes: 11 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var proc = require('child_process')
var execspawn = require('execspawn')
var os = require('os')
var path = require('path')
var fs = require('fs')
Expand Down Expand Up @@ -179,11 +178,12 @@ function copySharedLibs (builds, folder, opts, cb) {
function run (cmd, opts, cb) {
if (!cmd) return cb()

var child = execspawn(cmd, {
var child = proc.spawn(cmd, [], {
cwd: opts.cwd,
env: opts.env,
stdio: 'inherit',
shell: opts.shell
shell: opts.shell,
windowsHide: true
})

child.on('exit', function (code) {
Expand Down Expand Up @@ -230,6 +230,8 @@ function build (target, runtime, opts, cb) {
var child = proc.spawn(opts.nodeGyp, args, {
cwd: opts.cwd,
env: opts.env,
shell: opts.shell,
windowsHide: true,
stdio: opts.quiet ? 'ignore' : 'inherit'
})

Expand Down Expand Up @@ -266,7 +268,11 @@ function strip (file, opts, cb) {
if (!opts.strip || (platform !== 'darwin' && platform !== 'linux')) return cb()

var args = platform === 'darwin' ? [file, '-Sx'] : [file, '--strip-all']
var child = proc.spawn(opts.stripBin, args, { stdio: 'ignore' })
var child = proc.spawn(opts.stripBin, args, {
stdio: 'ignore',
shell: opts.shell,
windowsHide: true
})

child.on('exit', function (code) {
if (code) return cb(spawnError(opts.stripBin, code))
Expand Down Expand Up @@ -300,7 +306,7 @@ function npmbin (name) {
}

function shell () {
return os.platform() === 'android' ? 'sh' : undefined
return os.platform() === 'android' ? 'sh' : true
derevnjuk marked this conversation as resolved.
Show resolved Hide resolved
}

function resolveTargets (targets, all, napi, electronCompat) {
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
"description": "Create and package prebuilds for native modules",
"main": "index.js",
"dependencies": {
"execspawn": "^1.0.1",
"minimist": "^1.2.5",
"mkdirp-classic": "^0.5.3",
"node-abi": "^3.3.0",
"npm-run-path": "^3.1.0",
"minimist": "^1.2.5",
"pump": "^3.0.0",
"tar-fs": "^2.1.0"
},
Expand Down