'When L{os.execvpe} raises an exception, it will format that exception
on stderr as UTF-8, regardless of system encoding information.'

@onlyOnPOSIX
def test_errorDuringExec(self):

    def execvpe(*args, **kw):
        filename = u'<\u2603>'
        if (not isinstance(filename, str)):
            filename = filename.encode('utf-8')
        codeobj = compile('1/0', filename, 'single')
        eval(codeobj)
    self.patch(os, 'execvpe', execvpe)
    self.patch(sys, 'getfilesystemencoding', (lambda : 'ascii'))
    reactor = self.buildReactor()
    output = io.BytesIO()
    @reactor.callWhenRunning
    def whenRunning():
        class TracebackCatcher(ProcessProtocol, object, ):
            errReceived = output.write
            def processEnded(self, reason):
                reactor.stop()
        reactor.spawnProcess(TracebackCatcher(), pyExe, [pyExe, '-c', ''])
    self.runReactor(reactor, timeout=30)
    self.assertIn(u'\u2603'.encode('utf-8'), output.getvalue())
