This behavior is already provided by the built-in exec() function. We just need to check the return value of it.