code: 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);
          }
      }
docs: Attempt to lock this command.
  
  @param Output $output The output object to use for any error messages
  
  @return void