prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  [Bug] system.exit(code) is not respected in Hydra
  
  
  </issue>
  <code>
  [start of hydra/main.py]
  1 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
  2 import functools
  3 import sys
  4 from typing import Callable, Optional
  5 
  6 from ._internal.utils import get_args_parser, run_hydra
  7 from .types import TaskFunction
  8 
  9 # TODO: change config_path to Optional[str]
  10 
  11 
  12 def main(
  13     config_path: str = "", strict: Optional[bool] = None
  14 ) -> Callable[[TaskFunction], Callable[[], None]]:
  15     """
  16     :param config_path: the config path, can be a directory in which it's used as the config root
  17     or a file to load
  18     :param strict: strict mode, will throw an error if command line overrides are not changing an
  19     existing key or
  20            if the code is accessing a non existent key
  21     """
  22 
  23     def main_decorator(task_function: TaskFunction) -> Callable[[], None]:
  24         @functools.wraps(task_function)
  25         def decorated_main() -> None:
  26             try:
  27                 run_hydra(
  28                     args_parser=get_args_parser(),
  29                     task_function=task_function,
  30                     config_path=config_path,
  31                     strict=strict,
  32                 )
  33             except KeyboardInterrupt:
  34                 sys.exit(-1)
  35             except SystemExit:
  36                 pass
  37 
  38         return decorated_main
  39 
  40     return main_decorator
  41
  [end of hydra/main.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/hydra/main.py b/hydra/main.py
  --- a/hydra/main.py
  +++ b/hydra/main.py
  @@ -1,6 +1,5 @@
   # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
   import functools
  -import sys
   from typing import Callable, Optional
   
   from ._internal.utils import get_args_parser, run_hydra
  @@ -23,17 +22,12 @@
       def main_decorator(task_function: TaskFunction) -> Callable[[], None]:
           @functools.wraps(task_function)
           def decorated_main() -> None:
  -            try:
  -                run_hydra(
  -                    args_parser=get_args_parser(),
  -                    task_function=task_function,
  -                    config_path=config_path,
  -                    strict=strict,
  -                )
  -            except KeyboardInterrupt:
  -                sys.exit(-1)
  -            except SystemExit:
  -                pass
  +            run_hydra(
  +                args_parser=get_args_parser(),
  +                task_function=task_function,
  +                config_path=config_path,
  +                strict=strict,
  +            )
   
           return decorated_main
  
verification_info: {"golden_diff": "diff --git a/hydra/main.py b/hydra/main.py\n--- a/hydra/main.py\n+++ b/hydra/main.py\n@@ -1,6 +1,5 @@\n # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\n import functools\n-import sys\n from typing import Callable, Optional\n \n from ._internal.utils import get_args_parser, run_hydra\n@@ -23,17 +22,12 @@\n     def main_decorator(task_function: TaskFunction) -> Callable[[], None]:\n         @functools.wraps(task_function)\n         def decorated_main() -> None:\n-            try:\n-                run_hydra(\n-                    args_parser=get_args_parser(),\n-                    task_function=task_function,\n-                    config_path=config_path,\n-                    strict=strict,\n-                )\n-            except KeyboardInterrupt:\n-                sys.exit(-1)\n-            except SystemExit:\n-                pass\n+            run_hydra(\n+                args_parser=get_args_parser(),\n+                task_function=task_function,\n+                config_path=config_path,\n+                strict=strict,\n+            )\n \n         return decorated_main\n", "issue": "[Bug] system.exit(code) is not respected in Hydra\n\n", "before_files": [{"content": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport functools\nimport sys\nfrom typing import Callable, Optional\n\nfrom ._internal.utils import get_args_parser, run_hydra\nfrom .types import TaskFunction\n\n# TODO: change config_path to Optional[str]\n\n\ndef main(\n    config_path: str = \"\", strict: Optional[bool] = None\n) -> Callable[[TaskFunction], Callable[[], None]]:\n    \"\"\"\n    :param config_path: the config path, can be a directory in which it's used as the config root\n    or a file to load\n    :param strict: strict mode, will throw an error if command line overrides are not changing an\n    existing key or\n           if the code is accessing a non existent key\n    \"\"\"\n\n    def main_decorator(task_function: TaskFunction) -> Callable[[], None]:\n        @functools.wraps(task_function)\n        def decorated_main() -> None:\n            try:\n                run_hydra(\n                    args_parser=get_args_parser(),\n                    task_function=task_function,\n                    config_path=config_path,\n                    strict=strict,\n                )\n            except KeyboardInterrupt:\n                sys.exit(-1)\n            except SystemExit:\n                pass\n\n        return decorated_main\n\n    return main_decorator\n", "path": "hydra/main.py"}]}