Example #1
0
    def _waitForStart(self, readPipe):
        """
        Wait for the daemonization success.

        @param readPipe: file descriptor to read start information from.
        @type readPipe: C{int}

        @return: code to be passed to C{os._exit}: 0 for success, 1 for error.
        @rtype: C{int}
        """
        data = untilConcludes(os.read, readPipe, 100)
        dataRepr = _bytesRepr(data[2:])
        if data != b"0":
            msg = ("An error has occurred: {}\nPlease look at log "
                   "file for more information.\n".format(dataRepr))
            untilConcludes(sys.__stderr__.write, msg)
            return 1
        return 0
    def _waitForStart(self, readPipe):
        """
        Wait for the daemonization success.

        @param readPipe: file descriptor to read start information from.
        @type readPipe: C{int}

        @return: code to be passed to C{os._exit}: 0 for success, 1 for error.
        @rtype: C{int}
        """
        data = untilConcludes(os.read, readPipe, 100)
        dataRepr = _bytesRepr(data[2:])
        if data != b"0":
            msg = ("An error has occurred: %s\nPlease look at log "
                   "file for more information.\n" % (dataRepr,))
            untilConcludes(sys.__stderr__.write, msg)
            return 1
        return 0
Example #3
0
 def test_bytesReprPrefix(self):
     """
     L{twisted.python.compat._bytesRepr} always prepends
     ``b`` to the returned repr on both Python 2 and 3.
     """
     self.assertEqual(_bytesRepr(b'\x00'), "b'\\x00'")