Move the sh exec logic to source