working pipestatus method for getting a good return code