r138 - /debtorrent/trunk/debtorrent.py

camrdale-guest at users.alioth.debian.org camrdale-guest at users.alioth.debian.org
Mon Jul 9 23:19:32 UTC 2007


Author: camrdale-guest
Date: Mon Jul  9 23:19:32 2007
New Revision: 138

URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=138
Log:
Fix the forking to work better.

Modified:
    debtorrent/trunk/debtorrent.py

Modified: debtorrent/trunk/debtorrent.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/debtorrent.py?rev=138&op=diff
==============================================================================
--- debtorrent/trunk/debtorrent.py (original)
+++ debtorrent/trunk/debtorrent.py Mon Jul  9 23:19:32 2007
@@ -162,27 +162,20 @@
         print 'please report this to '+report_email
 
 if __name__ == '__main__':
-    if len(argv) > 1:
-        if argv[1] == ['--version']:
-            print version
-            exit(0)
-        elif argv[1] == ['--profile']:
-            import profile, pstats
-            p = profile.Profile()
-            p.runcall(run, argv[2:])
-            p.dump_stats('debtorrent.pstat')
-            # pstats.Stats(p).strip_dirs().sort_stats('cumulative').print_stats()
-            pstats.Stats(p).strip_dirs().sort_stats('time').print_stats()
-        elif argv[1] == ['--foreground']:
-            run(argv[2:])
-        else:
-            pid = os.fork()
-            if pid != 0:
-                exit(0)
-            run(argv[1:])
+    if argv[1:2] == ['--version']:
+        print version
+        exit(0)
+    elif argv[1:2] == ['--profile']:
+        import profile, pstats
+        p = profile.Profile()
+        p.runcall(run, argv[2:])
+        p.dump_stats('debtorrent.pstat')
+        # pstats.Stats(p).strip_dirs().sort_stats('cumulative').print_stats()
+        pstats.Stats(p).strip_dirs().sort_stats('time').print_stats()
+    elif argv[1:2] == ['--foreground']:
+        run(argv[2:])
     else:
         pid = os.fork()
         if pid != 0:
             exit(0)
         run(argv[1:])
-        




More information about the Debtorrent-commits mailing list