'Spawning a process with an executable which is a script starting
with an interpreter definition line (#!) uses that interpreter to
evaluate the script.'

def test_shebang(self):

    shebangOutput = 'this    is    the    shebang    output'
    scriptFile = self.makeSourceFile([('#!%s' % (pyExe.decode('ascii'),)), 'import    sys', ("sys.stdout.write('%s')" % (shebangOutput.decode('ascii'),)), 'sys.stdout.flush()'])
    os.chmod(scriptFile, 448)
    reactor = self.buildReactor()
    def cbProcessExited(args):
        (out, err, code) = args
        msg(('cbProcessExited((%r,    %r,    %d))' % (out, err, code)))
        self.assertEqual(out, shebangOutput)
        self.assertEqual(err, '')
        self.assertEqual(code, 0)
    def shutdown(passthrough):
        reactor.stop()
        return passthrough
    def start():
        d = utils.getProcessOutputAndValue(scriptFile, reactor=reactor)
        d.addBoth(shutdown)
        d.addCallback(cbProcessExited)
        d.addErrback(err)
    reactor.callWhenRunning(start)
    self.runReactor(reactor)
