From c3aec3e887d32ab361e5b6d864679adb135b5786 Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Sat, 18 Dec 2010 10:49:15 -0700 Subject: [PATCH] Revert "server: kill stdin/stdout/stderr" This is a useful thing, but requires that tasks behave correctly, sending their output via the usual bitbake messaging mechanisms, rather than via stdout. We'll postpone this until after the release. Signed-off-by: Chris Larson --- lib/bb/server/process.py | 9 --------- lib/bb/utils.py | 15 --------------- 2 files changed, 24 deletions(-) diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py index 78fa5be3f1a..27993484935 100644 --- a/lib/bb/server/process.py +++ b/lib/bb/server/process.py @@ -22,7 +22,6 @@ import logging import signal -import sys import time import bb import bb.event @@ -30,7 +29,6 @@ from multiprocessing import Process, Event from bb.cooker import BBCooker logger = logging.getLogger('BitBake') -NULL = open('/dev/null', 'r+') class ServerCommunicator(): def __init__(self, connection): @@ -90,13 +88,6 @@ class ProcessServer(Process): self._idlefunctions[function] = data def run(self): - """Run the server, killing off stdin/stdout/stderr""" - with bb.utils.redirected_fds([sys.stdin, sys.stdout, sys.stderr], - [NULL, NULL, NULL]): - return self.main() - - def main(self): - """Server main loop""" # Ignore SIGINT within the server, as all SIGINT handling is done by # the UI and communicated to us signal.signal(signal.SIGINT, signal.SIG_IGN) diff --git a/lib/bb/utils.py b/lib/bb/utils.py index 22793a9f654..761c243c62b 100644 --- a/lib/bb/utils.py +++ b/lib/bb/utils.py @@ -794,18 +794,3 @@ def init_logger(logger, verbose, debug, debug_domains): if debug_domains: bb.msg.set_debug_domains(debug_domains) - -@contextmanager -def redirected_fds(from_files, to_files): - assert len(from_files) == len(to_files), 'from_files / to_files length mismatch' - - old_fds = [] - for position, fobj in enumerate(from_files): - fd = fobj.fileno() - old_fds.append(os.dup(fd)) - os.dup2(to_files[position].fileno(), fd) - - yield - - for position, fd in enumerate(old_fds): - os.dup2(fd, from_files[position].fileno()) -- 2.47.3