Skip to content

Commit

Permalink
fix spawn EINVAL error
Browse files Browse the repository at this point in the history
  • Loading branch information
derevnjuk committed Apr 15, 2024
1 parent f891aa5 commit 0d253a1
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function build () {
]
} catch (_) {}

proc.spawn(args[0], args.slice(1), { stdio: 'inherit' }).on('exit', function (code) {
proc.spawn(args[0], args.slice(1), { stdio: 'inherit', shell: true, windowsHide: true }).on('exit', function (code) {
if (code || !process.argv[3]) process.exit(code)
exec(process.argv[3]).on('exit', function (code) {
process.exit(code)
Expand All @@ -45,15 +45,18 @@ function preinstall () {

function exec (cmd) {
if (process.platform !== 'win32') {
var shell = os.platform() === 'android' ? 'sh' : '/bin/sh'
return proc.spawn(shell, ['-c', '--', cmd], {
var shell = os.platform() === 'android' ? 'sh' : undefined
return proc.spawn(cmd, [], {
shell,
stdio: 'inherit'
})
}

return proc.spawn(process.env.comspec || 'cmd.exe', ['/s', '/c', '"' + cmd + '"'], {
return proc.spawn(cmd, [], {
windowsVerbatimArguments: true,
stdio: 'inherit'
stdio: 'inherit',
shell: true,
windowsHide: true
})
}

Expand Down

0 comments on commit 0d253a1

Please sign in to comment.