Pass client verbosity onto daemon if forked
authorJack Miller <jack@codezen.org>
Sat, 15 Nov 2014 21:10:58 +0000 (15:10 -0600)
committerJack Miller <jack@codezen.org>
Sat, 15 Nov 2014 21:10:58 +0000 (15:10 -0600)
(i.e. starting canto-curses -v will start canto-daemon -v if there isn't
already a daemon running)

canto_next/client.py

index 4d5f002..fefda86 100644 (file)
@@ -58,10 +58,12 @@ class CantoClient(CantoSocket):
             fd = os.open("/dev/null", os.O_RDWR)
             os.dup2(fd, sys.stderr.fileno())
 
+            cmd = "canto-daemon -D " + self.conf_dir
+            if self.verbosity > 0:
+                cmd += " -" + ("v" * self.verbosity)
+
             os.setpgid(os.getpid(), os.getpid())
-            os.execve("/bin/sh",
-                     ["/bin/sh", "-c", "canto-daemon -D " + self.conf_dir],
-                     os.environ)
+            os.execve("/bin/sh", ["/bin/sh", "-c", cmd], os.environ)
 
             # Should never get here, but just in case.
             sys.exit(-1)