oliverjrose99 / Recordurbate

A Bot to automatically record Chaturbate live streams.
GNU General Public License v3.0
233 stars 79 forks source link

Doesn't start #65

Closed newuser01986 closed 1 year ago

newuser01986 commented 2 years ago

Windows user.

Everything is installed, but "Python recordurbate.py start" does nothing, it just shows the menu. Looking at my logs it creates a rb.log which says "Starting daemon" but that is it. No rb.pid is created.

Deleting the double fork makes it work:

        # double fork
        try:
            pid = os.fork()
            if pid > 0:
                sys.exit(0)

            pid = os.fork()
            if pid > 0:
                sys.exit(0)

        except OSError as e:
            self.logger.info("Failed to daemonize, {}".format(e))
            print("Failed to daemonize, {}".format(e))
            sys.exit(1)

Which makes sense as pid is always greater than 0... would't this just cause it to always exit?

However, I dont see anything happening in the terminal, but videos ARE being downloaded and the log file has more content: Successfully started daemon, pid: 10840

leet86 commented 1 year ago

Is this issue resolved? It is running fine on WSL (Windows Subsystem for Linux) for me without removing the double fork.

See this article for example of os.fork() https://www.geeksforgeeks.org/python-os-fork-method/ When os.fork() is called, a second process is created, and both are running at the same line of code. One is the Parent process and the other is the Child process. However, os.fork() "returns 0 in the child process and child’s process id in the parent process".

I ran on Windows Powershell and got the same issue (with extra logging to explain what is happening on windows)

> python Recordurbate.py start
Recordurbate.py main() - calling Recordurbate.start()
Recordurbate.py bot()  - starting daemon
daemon.py daemonize() - calling os.fork()
Recordurbate.py bot()  - daemon created
Recordurbate.py main() - error occurred when calling Recordurbate.start()
Recordurbate.py main() - module 'os' has no attribute 'fork'

Propose to change the caught exception type from OSError to Exception