- Version: 6.4.0 - 8.0.0
- Platform:
- Subsystem:
spawnSync will segfault if called with an object that defines a throwing toString.
Here is a snippet using the high-level child_process API:
constspawn=require('child_process').spawnSync;constargs=[];constobj={};obj.toString=()=>{throw'yo';// causes ToString on spawn_sync.cc:964 to return empty handle; Set getfaults};args[0]=obj;spawn('ls',args);It may be safer to call toString in JS land before calling into the binding
code.
spawnSync will segfault if called with an object that defines a throwing
toString.Here is a snippet using the high-level
child_processAPI:It may be safer to call toString in JS land before calling into the binding
code.