operation.py: Do not fail when stdout is a StringIO

Under some circumstances, chromite code importing operation.py can have
sys.stdout reditected to a StringIO object rather than a file, in which
case an AttributeError gets thrown while checking for stdout's fileno.
This CL short-circuits the fileno check if fileno is not defined for
stdout).

BUG=None
TEST=chromite unit tests pass

Change-Id: I4412a37ad2128a992087fbbaefe7748244d76820
Reviewed-on: https://chromium-review.googlesource.com/60107
Tested-by: Aviv Keshet <akeshet@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Aviv Keshet <akeshet@chromium.org>
1 file changed