Use which instead of type to check if a binary exists

For example if mvn is a defined shell function but mvn is
not installed the method ensure_exists will return True even
mvn is not installed.

% type mvn
mvn is a shell function

% which mvn
/usr/bin/which: no mvn in (...)

Change-Id: Ic751660c030e687ca6bc53656fd49c5563cfc71f
Merge "Use which instead of type to check if a binary exists"