code: def run(self):
          
          _check_directory(self.directory)
  
          with DirectoryContextManager(self.directory):
              process = subprocess.Popen(self.arguments, shell=self._shell, env=self.env)
  
              _, _ = process.communicate()
  
          returncode = process.returncode
  
          if returncode != 0 and not self._ignore_errors:
              raise CommandError(
                  '"{0}" failed (err code {1})'.format(self.__repr__(), returncode)
              )
docs: Run command and wait until it finishes.