Can't use process.binding directly #50903
-
I'm trying to bypass a JS sandbox and I need to invoke spawn without child_process, so I used the following to test it:
However nodejs returns error
My questions,
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
parameters of
|
Beta Was this translation helpful? Give feedback.
-
It calls
Maybe you should try the code as follows: const spawn = process.binding('spawn_sync').spawn
let result = spawn({
file: 'open',
args: ['open', '/System/Applications/Calculator.app'],
shell: true,
detached: false,
stdio: [ // the key is here, you should pass a valid stdio, if stdio is `null` or `undefined` it will returns -22
{ type: 'pipe', readable: true, writable: false }
]
})
console.log(result) Hope this helps you. |
Beta Was this translation helpful? Give feedback.
-
Yes, JimmyDaddy is right. The parameters look like this. |
Beta Was this translation helpful? Give feedback.
@CaledoniaProject
It calls
normalizeSpawnArguments
to format the arguments before callingspawn_sync.spawn
inchild_process.spawnSync
. the source code here-22
means invalid paramspid = 0
means no process has been startedMaybe you should try the code as follows: