from twisted.internet import reactor, utils


def printTrueValue(val):
    print("/bin/true exits with rc=%d" % val)
    output = utils.getProcessValue("/bin/false")
    output.addCallback(printFalseValue)


def printFalseValue(val):
    print("/bin/false exits with rc=%d" % val)
    reactor.stop()


output = utils.getProcessValue("/bin/true")
output.addCallback(printTrueValue)
reactor.run()
