public function lock(Output $output)
    {
        # If this command doesn't require locking then don't do anything
        if (!$this->lock) {
            return;
        }

        $this->lock = $this->getApplication()->getLockFactory()->createLock($this->getName());

        if (!$this->lock->acquire()) {
            $output->error("Another instance of this command (" . $this->getName() . ") is currently running");
            exit(Application::STATUS_LOCKED);
        }
    }