예제 #1
0
    def run(self, content, log):
        assert isinstance(content, bytes), (`content`, type(content))
        assert self.rref is not None
        options = ClientOptions()
        options.parseOptions(self.flappclient_args)

        def stdio(proto):
            # This value is being sent to the stdin of the flapp.
            proto.dataReceived(content)
            proto.connectionLost("EOF")

        options.subOptions.stdio = stdio

        # These are not used.
        options.subOptions.stdout = None
        options.subOptions.stderr = None

        print >>log, "Starting command."
        self.d = RunCommand().run(self.rref, options.subOptions)
        def _log_return_code(rc):
            print >>log, "Command completed with exit code %r" % (rc,)
        def _log_failure(f):
            print >>log, "Command failed with %r" % (f,)

        self.d.addCallbacks(_log_return_code, _log_failure)
        return self.d
예제 #2
0
 def _go(ign):
     print >> stdout, "Starting..."
     return RunCommand().run(self.rref, options.subOptions)