Only attempt to use sudo if necessary