Basically forking means to make an exact copy of the current process into another process upto the point of forking (right? It's the way I've understood, please correct me if I'm wrong)
So, In a GUI if I put a code to a say button that forks a process to open a browser, shouldn't that make my current GUI window into two GUI windows? But the result is only one. What I mean by making two GUI windows is that, if it copies the process up to the point of forking then Shouldn't it also make a duplicate window since it copied all the code?
The minimal runnable code is here:
from kivy.app import App
from kivy.uix.label import Label
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
import webbrowser, os
class something(BoxLayout):
def __init__(self):
super().__init__()
self.add_widget(Button(text='test button'))
self.add_widget(Label(text='[ref=video]google.com[/ref]',
markup=True,
on_ref_press=lambda *_: self.open_browser('https://google.com')))
def open_browser(self, site):
if not os.fork():
webbrowser.open(site)
class MainApp(App):
def build(self):
return something()
if __name__ == '__main__':
MainApp().run()
For some reason the GUI becomes unresponsive after it does the fork and there are no two GUI windows after the forking is done. What is the theory behind it?