Handle error code, stdout and stderr for prepublish script