extracted the handling of the results of an executed command