
import os
import threading
from time import sleep


def start_satellite(target, args=(), kwargs=None, stop=None):
    """
    Start a process configured to run the target but kill it after the parent
    exits.
    """

    if kwargs is None:
        kwargs = {}

    pid = os.fork()
    if pid == 0:
        # Run target daemonized.
        payload = threading.Thread(
            target=target,
            args=args,
            kwargs=kwargs,
            daemon=True,
        )
        payload.start()

        # Cannot wait for the process that's not our child
        ppid = os.getppid()
        try:
            while True:
                os.kill(ppid, 0)
                sleep(1)
        except OSError:
            if stop:
                stop()

        os._exit(os.EX_OK)  # pylint:disable=protected-access


import os
import threading
from time import sleep


def start_satellite(target, args=(), kwargs=None, stop=None):
    """
    Start a process configured to run the target but kill it after the parent
    exits.
    """

    if kwargs is None:
        kwargs = {}

    pid = os.fork()
    if pid == 0:
        # Run target daemonized.
        payload = threading.Thread(
            target=target,
            args=args,
            kwargs=kwargs,
        )
        payload.daemon = True
        payload.start()

        # Cannot wait for the process that's not our child
        ppid = os.getppid()
        try:
            while True:
                os.kill(ppid, 0)
                sleep(1)
        except OSError:
            if stop:
                stop()

        os._exit(os.EX_OK)  # pylint:disable=protected-access

Fix making threads daemonic on Python 3.2
Fix making threads daemonic on Python 3.2

  
  import os
  import threading
  from time import sleep
  
  
  def start_satellite(target, args=(), kwargs=None, stop=None):
      """
      Start a process configured to run the target but kill it after the parent
      exits.
      """
  
      if kwargs is None:
          kwargs = {}
  
      pid = os.fork()
      if pid == 0:
          # Run target daemonized.
          payload = threading.Thread(
              target=target,
              args=args,
              kwargs=kwargs,
-             daemon=True,
          )
+         payload.daemon = True
          payload.start()
  
          # Cannot wait for the process that's not our child
          ppid = os.getppid()
          try:
              while True:
                  os.kill(ppid, 0)
                  sleep(1)
          except OSError:
              if stop:
                  stop()
  
          os._exit(os.EX_OK)  # pylint:disable=protected-access
  
Fix making threads daemonic on Python 3.2
## Code Before:

import os
import threading
from time import sleep


def start_satellite(target, args=(), kwargs=None, stop=None):
    """
    Start a process configured to run the target but kill it after the parent
    exits.
    """

    if kwargs is None:
        kwargs = {}

    pid = os.fork()
    if pid == 0:
        # Run target daemonized.
        payload = threading.Thread(
            target=target,
            args=args,
            kwargs=kwargs,
            daemon=True,
        )
        payload.start()

        # Cannot wait for the process that's not our child
        ppid = os.getppid()
        try:
            while True:
                os.kill(ppid, 0)
                sleep(1)
        except OSError:
            if stop:
                stop()

        os._exit(os.EX_OK)  # pylint:disable=protected-access

## Instruction:
Fix making threads daemonic on Python 3.2
## Code After:

import os
import threading
from time import sleep


def start_satellite(target, args=(), kwargs=None, stop=None):
    """
    Start a process configured to run the target but kill it after the parent
    exits.
    """

    if kwargs is None:
        kwargs = {}

    pid = os.fork()
    if pid == 0:
        # Run target daemonized.
        payload = threading.Thread(
            target=target,
            args=args,
            kwargs=kwargs,
        )
        payload.daemon = True
        payload.start()

        # Cannot wait for the process that's not our child
        ppid = os.getppid()
        try:
            while True:
                os.kill(ppid, 0)
                sleep(1)
        except OSError:
            if stop:
                stop()

        os._exit(os.EX_OK)  # pylint:disable=protected-access
