Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def _deliver_command(self, msg, msginfo, delivered_to, received,
- stdout, stderr):
- try:
- # Write out message with native EOL convention
- msgfile = tempfile.TemporaryFile()
- msgfile.write(msg.flatten(delivered_to, received,
- include_from=self.conf['unixfrom']))
- msgfile.flush()
- os.fsync(msgfile.fileno())
- # Rewind
- msgfile.seek(0)
- # Set stdin to read from this file
- os.dup2(msgfile.fileno(), 0)
- # Set stdout and stderr to write to files
- os.dup2(stdout.fileno(), 1)
- os.dup2(stderr.fileno(), 2)
- os.dup2(stdout.fileno(), 1)
Add Comment
Please, Sign In to add comment