prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Scheduler only hosts on unix socket when run in the background
  Support for hosting the central scheduler on a unix socket was added, which is nice, but the scheduler ignores the `--unix-socket` argument from the command line when `--background` is not also supplied.  
  
  This will work properly, and the scheduler will listen on the provided unix socket:
  
  ```
  luigid --unix-socket /path/to/socket --background
  ```
  
  With this command, the scheduler will still listen on the default port (8082):
  
  ```
  luigid --unix-socket /path/to/socket
  ```
  
  Fixing this would be a simple matter of passing the `unix_socket` argument onto the call to `server.run` in the case where the server is not daemonized, but was there a reason this functionality was left out in the first place?  If so, it probably ought to be in the documentation; as is, reading it gives me the impression that I should be able to tell the scheduler to listen on a unix socket regardless of whether it's running in the background.
  
  
  </issue>
  <code>
  [start of luigi/cmdline.py]
  1 import os
  2 import argparse
  3 import logging
  4 import sys
  5 
  6 from luigi.retcodes import run_with_retcodes
  7 
  8 
  9 def luigi_run(argv=sys.argv[1:]):
  10     run_with_retcodes(argv)
  11 
  12 
  13 def luigid(argv=sys.argv[1:]):
  14     import luigi.server
  15     import luigi.process
  16     import luigi.configuration
  17     parser = argparse.ArgumentParser(description=u'Central luigi server')
  18     parser.add_argument(u'--background', help=u'Run in background mode', action='store_true')
  19     parser.add_argument(u'--pidfile', help=u'Write pidfile')
  20     parser.add_argument(u'--logdir', help=u'log directory')
  21     parser.add_argument(u'--state-path', help=u'Pickled state file')
  22     parser.add_argument(u'--address', help=u'Listening interface')
  23     parser.add_argument(u'--unix-socket', help=u'Unix socket path')
  24     parser.add_argument(u'--port', default=8082, help=u'Listening port')
  25 
  26     opts = parser.parse_args(argv)
  27 
  28     if opts.state_path:
  29         config = luigi.configuration.get_config()
  30         config.set('scheduler', 'state_path', opts.state_path)
  31 
  32     if opts.background:
  33         # daemonize sets up logging to spooled log files
  34         logging.getLogger().setLevel(logging.INFO)
  35         luigi.process.daemonize(luigi.server.run, api_port=opts.port,
  36                                 address=opts.address, pidfile=opts.pidfile,
  37                                 logdir=opts.logdir, unix_socket=opts.unix_socket)
  38     else:
  39         if opts.logdir:
  40             logging.basicConfig(level=logging.INFO, format=luigi.process.get_log_format(),
  41                                 filename=os.path.join(opts.logdir, "luigi-server.log"))
  42         else:
  43             logging.basicConfig(level=logging.INFO, format=luigi.process.get_log_format())
  44         luigi.server.run(api_port=opts.port, address=opts.address)
  45
  [end of luigi/cmdline.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/luigi/cmdline.py b/luigi/cmdline.py
  --- a/luigi/cmdline.py
  +++ b/luigi/cmdline.py
  @@ -41,4 +41,4 @@
                                   filename=os.path.join(opts.logdir, "luigi-server.log"))
           else:
               logging.basicConfig(level=logging.INFO, format=luigi.process.get_log_format())
  -        luigi.server.run(api_port=opts.port, address=opts.address)
  +        luigi.server.run(api_port=opts.port, address=opts.address, unix_socket=opts.unix_socket)
  
verification_info: {"golden_diff": "diff --git a/luigi/cmdline.py b/luigi/cmdline.py\n--- a/luigi/cmdline.py\n+++ b/luigi/cmdline.py\n@@ -41,4 +41,4 @@\n                                 filename=os.path.join(opts.logdir, \"luigi-server.log\"))\n         else:\n             logging.basicConfig(level=logging.INFO, format=luigi.process.get_log_format())\n-        luigi.server.run(api_port=opts.port, address=opts.address)\n+        luigi.server.run(api_port=opts.port, address=opts.address, unix_socket=opts.unix_socket)\n", "issue": "Scheduler only hosts on unix socket when run in the background\nSupport for hosting the central scheduler on a unix socket was added, which is nice, but the scheduler ignores the `--unix-socket` argument from the command line when `--background` is not also supplied.  \n\nThis will work properly, and the scheduler will listen on the provided unix socket:\n\n```\nluigid --unix-socket /path/to/socket --background\n```\n\nWith this command, the scheduler will still listen on the default port (8082):\n\n```\nluigid --unix-socket /path/to/socket\n```\n\nFixing this would be a simple matter of passing the `unix_socket` argument onto the call to `server.run` in the case where the server is not daemonized, but was there a reason this functionality was left out in the first place?  If so, it probably ought to be in the documentation; as is, reading it gives me the impression that I should be able to tell the scheduler to listen on a unix socket regardless of whether it's running in the background.\n\n", "before_files": [{"content": "import os\nimport argparse\nimport logging\nimport sys\n\nfrom luigi.retcodes import run_with_retcodes\n\n\ndef luigi_run(argv=sys.argv[1:]):\n    run_with_retcodes(argv)\n\n\ndef luigid(argv=sys.argv[1:]):\n    import luigi.server\n    import luigi.process\n    import luigi.configuration\n    parser = argparse.ArgumentParser(description=u'Central luigi server')\n    parser.add_argument(u'--background', help=u'Run in background mode', action='store_true')\n    parser.add_argument(u'--pidfile', help=u'Write pidfile')\n    parser.add_argument(u'--logdir', help=u'log directory')\n    parser.add_argument(u'--state-path', help=u'Pickled state file')\n    parser.add_argument(u'--address', help=u'Listening interface')\n    parser.add_argument(u'--unix-socket', help=u'Unix socket path')\n    parser.add_argument(u'--port', default=8082, help=u'Listening port')\n\n    opts = parser.parse_args(argv)\n\n    if opts.state_path:\n        config = luigi.configuration.get_config()\n        config.set('scheduler', 'state_path', opts.state_path)\n\n    if opts.background:\n        # daemonize sets up logging to spooled log files\n        logging.getLogger().setLevel(logging.INFO)\n        luigi.process.daemonize(luigi.server.run, api_port=opts.port,\n                                address=opts.address, pidfile=opts.pidfile,\n                                logdir=opts.logdir, unix_socket=opts.unix_socket)\n    else:\n        if opts.logdir:\n            logging.basicConfig(level=logging.INFO, format=luigi.process.get_log_format(),\n                                filename=os.path.join(opts.logdir, \"luigi-server.log\"))\n        else:\n            logging.basicConfig(level=logging.INFO, format=luigi.process.get_log_format())\n        luigi.server.run(api_port=opts.port, address=opts.address)\n", "path": "luigi/cmdline.py"}]}