childpid = os.fork()
if (not childpid):
if (root and root != '/'):
- os.chroot (root)
+ os.chroot(root)
os.chdir("/")
- if ignoreTermSigs:
- signal.signal(signal.SIGTSTP, signal.SIG_IGN)
- signal.signal(signal.SIGINT, signal.SIG_IGN)
-
- if type(stdin) == type("a"):
- stdin = os.open(stdin, os.O_RDONLY)
- if type(stdout) == type("a"):
- stdout = os.open(stdout, os.O_RDWR)
- if type(stderr) == type("a"):
- stderr = os.open(stderr, os.O_RDWR)
-
- if stdin != 0:
- os.dup2(stdin, 0)
- os.close(stdin)
- if stdout != 1:
- os.dup2(stdout, 1)
- if stdout != stderr:
- os.close(stdout)
- if stderr != 2:
- os.dup2(stderr, 2)
- os.close(stderr)
-
- if (searchPath):
- os.execvp(command, argv)
- else:
- os.execv(command, argv)
+ if ignoreTermSigs:
+ signal.signal(signal.SIGTSTP, signal.SIG_IGN)
+ signal.signal(signal.SIGINT, signal.SIG_IGN)
+
+ if type(stdin) == type("a"):
+ stdin = os.open(stdin, os.O_RDONLY)
+ if type(stdout) == type("a"):
+ stdout = os.open(stdout, os.O_RDWR)
+ if type(stderr) == type("a"):
+ stderr = os.open(stderr, os.O_RDWR)
+
+ if stdin != 0:
+ os.dup2(stdin, 0)
+ os.close(stdin)
+ if stdout != 1:
+ os.dup2(stdout, 1)
+ if stdout != stderr:
+ os.close(stdout)
+ if stderr != 2:
+ os.dup2(stderr, 2)
+ os.close(stderr)
+
+ if (searchPath):
+ os.execvp(command, argv)
+ else:
+ os.execv(command, argv)
- sys.exit(1)
+ sys.exit(1)
if newPgrp:
os.setpgid(childpid, childpid)
os.close(write)
os.close(read)
- if closefd != -1:
- os.close(closefd)
-
- if stdin:
- os.dup2(stdin, 0)
- os.close(stdin)
-
- if (searchPath):
- os.execvp(command, argv)
- else:
- os.execv(command, argv)
-
- sys.exit(1)
+ if closefd != -1:
+ os.close(closefd)
+
+ if stdin:
+ os.dup2(stdin, 0)
+ os.close(stdin)
+
+ if (searchPath):
+ os.execvp(command, argv)
+ else:
+ os.execv(command, argv)
+
+ sys.exit(1)
os.close(write)
for dom in domain:
if dom in self.domains:
self.domains.pop(self.domains.index(dom))
- self.domains.insert(0, dom)
+ self.domains.insert(0, dom)
else:
if domain in self.domains:
self.domains.pop(self.domains.index(domain))
self.iconv = theiconv
break
- # now let's put None at the beginning of the list as it corresponds
- # to the "current" local po files for testing
- self.domains.insert(0, None)
+ # now let's put None at the beginning of the list as it corresponds
+ # to the "current" local po files for testing
+ self.domains.insert(0, None)
- if len(self.cats) == 0:
- encoding = locale.nl_langinfo (locale.CODESET)
-# sys.stderr.write("WARNING: Unable to find catalog, using %s for codeset, %s for encoding\n" %(self.codeset, encoding))
- try:
- self.iconv = iconv.open(self.codeset, encoding)
- except:
- sys.stderr.write("FAILED to create iconv with codeset %s and encoding %s\n" %(self.codeset, encoding));
- return
+ #if len(self.cats) == 0:
+ # encoding = locale.nl_langinfo(locale.CODESET)
+ # sys.stderr.write("WARNING: Unable to find catalog, using %s for codeset, %s for encoding\n" %(self.codeset, encoding))
+ # try:
+ # self.iconv = iconv.open(self.codeset, encoding)
+ # except:
+ # sys.stderr.write("FAILED to create iconv with codeset %s and encoding %s\n" %(self.codeset, encoding));
+ # return
def setDomainCodeset(self, domain, codeset):
self.codeset = codeset