diff options
author | Richard Hughes <richard@hughsie.com> | 2010-10-29 15:48:58 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2010-10-29 15:48:58 +0100 |
commit | 237d1d3294b0d43d9e3aa2142f9bf5b124c54d0e (patch) | |
tree | 74d284dc685def80716528ec50ab0b952cbcace4 /data | |
parent | 1eba1c8e6cc8c523fd60305b4bbc61865df8bf33 (diff) |
Add PkClientHelper, which allows a helper session program to be run for a transaction
Diffstat (limited to 'data')
-rw-r--r-- | data/tests/Makefile.am | 1 | ||||
-rw-r--r-- | data/tests/pk-client-helper-test.py | 42 |
2 files changed, 43 insertions, 0 deletions
diff --git a/data/tests/Makefile.am b/data/tests/Makefile.am index aa719e253..cee437736 100644 --- a/data/tests/Makefile.am +++ b/data/tests/Makefile.am @@ -5,6 +5,7 @@ NULL = TEST_FILES = \ test.catalog \ + pk-client-helper-test.py \ pk-spawn-test.sh \ pk-spawn-proxy.sh \ pk-spawn-test-sigquit.sh \ diff --git a/data/tests/pk-client-helper-test.py b/data/tests/pk-client-helper-test.py new file mode 100644 index 000000000..e8f1d35b7 --- /dev/null +++ b/data/tests/pk-client-helper-test.py @@ -0,0 +1,42 @@ +#!/usr/bin/python +# Licensed under the GNU General Public License Version 2 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Copyright (C) 2010 Richard Hughes <richard@hughsie.com> + +import sys + +def main(): + while True: + try: + line = sys.stdin.readline().strip('\n') + except IOError, e: + print "could not read from stdin: %s", str(e) + break + except KeyboardInterrupt, e: + print "process was killed by ctrl-c", str(e) + break; + if not line or line == 'exit': + break + if line == 'ping': + sys.stdout.write ('pong\n') + sys.stdout.flush() + else: + sys.stdout.write ("you said to me: %s\n" % line) + sys.stdout.flush() + +if __name__ == "__main__": + main() |