Replace to-be deprecated popen4 with shellout

**[WIP]**

Replace deprecated popen4 with shellout