aboutsummaryrefslogtreecommitdiffstats
path: root/torouterui
diff options
context:
space:
mode:
authorficus <ficus@robocracy.org>2012-11-25 02:23:24 +0100
committerficus <ficus@robocracy.org>2012-11-25 02:25:30 +0100
commit17f9bf637866bd9dbf63cce097a2db85f92e15cc (patch)
tree547d750bb3a64dd3c9eb01538b062f5791bcc827 /torouterui
parent1ab996d30b595388d2f431b1ed31bf5cf095e5c2 (diff)
downloadtui-17f9bf637866bd9dbf63cce097a2db85f92e15cc.tar.gz
tui-17f9bf637866bd9dbf63cce097a2db85f92e15cc.zip
fix fork() file descriptor (socket) bug
Diffstat (limited to 'torouterui')
-rw-r--r--torouterui/util.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/torouterui/util.py b/torouterui/util.py
index c459fa0..16e7f57 100644
--- a/torouterui/util.py
+++ b/torouterui/util.py
@@ -4,6 +4,7 @@ command line programs, plus a couple misc other functions.
"""
import os
+import subprocess
def cli_read(cmd):
p = os.popen(cmd)
@@ -18,15 +19,13 @@ def fs_read(path):
return ''.join(f.readlines())
def enable_service(name):
- os.system('update-rc.d %s defaults &' % name)
- # safe to "restart" most services if they are already running
- os.system('/etc/init.d/%s start &' % name)
+ #os.system('update-rc.d %s defaults &' % name)
+ subprocess.Popen(['service', name, 'start'], close_fds=True)
def disable_service(name):
"""Currently, this is never actually called"""
- os.system('update-rc.d %s remove &' % name)
- # safe to "restart" most services if they are already running
- os.system('/etc/init.d/%s stop &' % name)
+ #os.system('update-rc.d %s remove &' % name)
+ subprocess.Popen(['nohup', 'service', name, 'stop'], close_fds=True)
def prefix_to_ipv4_mask(prefixlen):
assert(prefixlen >= 0)