def startWorker(basedir, quiet, nodaemon):
    """
    Start worker process.

    Fork and start twisted application described in basedir buildbot.tac file.
    Print it's log messages to stdout for a while and try to figure out if
    start was successful.

    If quiet or nodaemon parameters are True, or we are running on a win32
    system, will not fork and log will not be printed to stdout.

    @param  basedir: worker's basedir path
    @param    quiet: don't display startup log messages
    @param nodaemon: don't daemonize (stay in foreground)
    @return: 0 if worker was successfully started,
             1 if we are not sure that worker started successfully
    """

    os.chdir(basedir)
    if quiet or nodaemon:
        return launch(nodaemon)

    # we probably can't do this os.fork under windows
    from twisted.python.runtime import platformType
    if platformType == "win32":
        return launch(nodaemon)

    # fork a child to launch the daemon, while the parent process tails the
    # logfile
    if os.fork():
        # this is the parent
        rc = Follower().follow()
        return rc
    # this is the child: give the logfile-watching parent a chance to start
    # watching it before we start the daemon
    time.sleep(0.2)
    launch(nodaemon)
Start worker process.

    Fork and start twisted application described in basedir buildbot.tac file.
    Print it's log messages to stdout for a while and try to figure out if
    start was successful.

    If quiet or nodaemon parameters are True, or we are running on a win32
    system, will not fork and log will not be printed to stdout.

    @param  basedir: worker's basedir path
    @param    quiet: don't display startup log messages
    @param nodaemon: don't daemonize (stay in foreground)
    @return: 0 if worker was successfully started,
             1 if we are not sure that worker started successfully