Repository: packit/packit
Issue: packit build command fail but work

How to reproduce:

- Run `packit --debug build`.
- Get an error: `ERROR    Command ['fedpkg', 'build'] failed: Submission of build to koji failed.`
- The build is actually triggered. (The link is in the debug log.)

Example:

```sh
packit --debug build --dist-git-branch f31
11:45:51.179 config.py         DEBUG  Loading user config from directory: /home/flachman/.config
11:45:51.179 config.py         DEBUG  Trying to load user config from: /home/flachman/.config/.packit.yaml
11:45:51.181 utils.py          DEBUG  logging set to DEBUG
Packit 0.7.1.dev29+g9f8a111 is being used.
Input is a directory: /home/flachman/Projects/src.fedoraproject/packit
:
:
11:45:51.211 distgit.py        DEBUG  About to update branch 'f31'
won't be doing kinit, no credentials provided
11:45:54.220 utils.py          DEBUG  cmd = 'fedpkg build'
11:45:58.806 utils.py          DEBUG  STDOUT: Building packit-0.7.1-1.fc31 for f31-candidate
Created task: 38518718
Task info: https://koji.fedoraproject.org/koji/taskinfo?taskID=38518718
STDERR: Could not execute build: watch_tasks() got an unexpected keyword argument 'ki_handler'
ERROR    Command ['fedpkg', 'build'] failed
ERROR    Submission of build to koji failed.
ERROR    Command ['fedpkg', 'build'] failed: Submission of build to koji failed.
Traceback (most recent call last):
  File "/home/flachman/.local/lib/python3.7/site-packages/packit/cli/utils.py", line 61, in covered_func
    func(config=config, *args, **kwargs)
  File "/home/flachman/.local/lib/python3.7/site-packages/packit/cli/build.py", line 70, in build
    api.build(dist_git_branch, scratch=scratch, nowait=nowait, koji_target=koji_target)
  File "/home/flachman/.local/lib/python3.7/site-packages/packit/api.py", line 411, in build
    self.dg.build(scratch=scratch, nowait=nowait, koji_target=koji_target)
  File "/home/flachman/.local/lib/python3.7/site-packages/packit/distgit.py", line 312, in build
    fpkg.build(scratch=scratch, nowait=nowait, koji_target=koji_target)
  File "/home/flachman/.local/lib/python3.7/site-packages/packit/fedpkg.py", line 76, in build
    fail=True,
  File "/home/flachman/.local/lib/python3.7/site-packages/packit/utils.py", line 133, in run_command_remote
    return run_command(cmd, error_message, cwd, fail, output, env)
  File "/home/flachman/.local/lib/python3.7/site-packages/packit/utils.py", line 105, in run_command
    raise PackitException(f"Command {shell.args!r} failed: {error_message}")
packit.exceptions.PackitException: Command ['fedpkg', 'build'] failed: Submission of build to koji failed.

```

Changed files:
packit/fedpkg.py

diff --git a/packit/fedpkg.py b/packit/fedpkg.py
index 155b4b4b..b4cfac13 100644
--- a/packit/fedpkg.py
+++ b/packit/fedpkg.py
@@ -23,6 +23,8 @@
 from pathlib import Path
 from typing import Optional
 
+from packit.exceptions import PackitCommandFailedError
+
 from packit import utils  # so we can mock utils
 from packit.utils import logger
 
@@ -81,12 +83,29 @@ class FedPKG:
             cmd += ["--target", koji_target]
         if srpm_path:
             cmd += ["--srpm", str(srpm_path)]
-        utils.run_command_remote(
-            cmd=cmd,
-            cwd=self.directory,
-            error_message="Submission of build to koji failed.",
-            fail=True,
-        )
+
+        try:
+            utils.run_command_remote(
+                cmd=cmd,
+                cwd=self.directory,
+                error_message="Submission of build to koji failed.",
+                fail=True,
+            )
+
+        except PackitCommandFailedError as ex:
+            # fail on the fedpkg side, the build is triggered
+            if (
+                "watch_tasks() got an unexpected keyword argument 'ki_handler'"
+                in ex.stderr_output
+            ):
+                logger.info(
+                    "fedpkg build command crashed which is a known issue: "
+                    "the build is submitted in koji anyway"
+                )
+                logger.debug(ex.stdout_output)
+
+            else:
+                raise
 
     def clone(self, package_name: str, target_path: str, anonymous: bool = False):
         """