Tell the user when a background update completes, not when it starts
[zeroinstall/solver.git] / zeroinstall / 0launch-gui / browser.py
blobe85c7f7b38ea662a1e248e3086e8f76aaf188ec6
1 # Copyright (C) 2009, Thomas Leonard
2 # See the README file for details, or visit http://0install.net.
4 from __future__ import print_function
6 import os, sys
8 def open_in_browser(link):
9 browser = os.environ.get('BROWSER', 'firefox')
10 child = os.fork()
11 if child == 0:
12 # We are the child
13 try:
14 os.spawnlp(os.P_NOWAIT, browser, browser, link)
15 os._exit(0)
16 except Exception as ex:
17 print("Error", ex, file=sys.stderr)
18 os._exit(1)
19 os.waitpid(child, 0)