Bram Moolenaar | 6463ca2 | 2016-02-13 17:04:46 +0100 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | # |
| 3 | # Server that will communicate over stdin/stderr |
| 4 | # |
| 5 | # This requires Python 2.6 or later. |
| 6 | |
| 7 | from __future__ import print_function |
| 8 | import sys |
| 9 | |
| 10 | if __name__ == "__main__": |
| 11 | |
| 12 | if len(sys.argv) > 1: |
| 13 | print(sys.argv[1]) |
| 14 | |
| 15 | while True: |
| 16 | typed = sys.stdin.readline() |
| 17 | if typed.startswith("quit"): |
| 18 | print("Goodbye!") |
| 19 | sys.stdout.flush() |
| 20 | break |
| 21 | if typed.startswith("echo"): |
| 22 | print(typed[5:-1]) |
| 23 | sys.stdout.flush() |
Bram Moolenaar | 9a6e33a | 2016-02-16 19:25:12 +0100 | [diff] [blame] | 24 | if typed.startswith("double"): |
| 25 | print(typed[7:-1] + "\nAND " + typed[7:-1]) |
| 26 | sys.stdout.flush() |
Bram Moolenaar | 6463ca2 | 2016-02-13 17:04:46 +0100 | [diff] [blame] | 27 | |