Revision 7b4baeb1 lib/utils/__init__.py
b/lib/utils/__init__.py | ||
---|---|---|
62 | 62 |
|
63 | 63 |
|
64 | 64 |
#: when set to True, L{RunCmd} is disabled |
65 |
no_fork = False |
|
65 |
_no_fork = False
|
|
66 | 66 |
|
67 | 67 |
_RANDOM_UUID_FILE = "/proc/sys/kernel/random/uuid" |
68 | 68 |
|
... | ... | |
93 | 93 |
_ASN1_TIME_REGEX = re.compile(r"^(\d+)([-+]\d\d)(\d\d)$") |
94 | 94 |
|
95 | 95 |
|
96 |
def DisableFork(): |
|
97 |
"""Disables the use of fork(2). |
|
98 |
|
|
99 |
""" |
|
100 |
global _no_fork # pylint: disable-msg=W0603 |
|
101 |
|
|
102 |
_no_fork = True |
|
103 |
|
|
104 |
|
|
96 | 105 |
class RunResult(object): |
97 | 106 |
"""Holds the result of running external programs. |
98 | 107 |
|
... | ... | |
203 | 212 |
@raise errors.ProgrammerError: if we call this when forks are disabled |
204 | 213 |
|
205 | 214 |
""" |
206 |
if no_fork: |
|
215 |
if _no_fork:
|
|
207 | 216 |
raise errors.ProgrammerError("utils.RunCmd() called with fork() disabled") |
208 | 217 |
|
209 | 218 |
if output and interactive: |
... | ... | |
318 | 327 |
@raise errors.ProgrammerError: if we call this when forks are disabled |
319 | 328 |
|
320 | 329 |
""" |
321 |
if no_fork: |
|
330 |
if _no_fork:
|
|
322 | 331 |
raise errors.ProgrammerError("utils.StartDaemon() called with fork()" |
323 | 332 |
" disabled") |
324 | 333 |
|
Also available in: Unified diff