Updated external_exec to use proc_open