Open interactive PostScript shell.
(self, arg)
| 86 | |
| 87 | # ------------------------[ shell ]----------------------------------- |
| 88 | def do_shell(self, arg): |
| 89 | "Open interactive PostScript shell." |
| 90 | # politely request poor man's remote postscript shell |
| 91 | output().info("Launching PostScript shell. Press CTRL+D to exit.") |
| 92 | try: |
| 93 | self.send(c.UEL + c.PS_HEADER + "false echo executive\n") |
| 94 | while True: |
| 95 | # use postscript prompt or error message as delimiter |
| 96 | str_recv = self.recv(c.PS_PROMPT + "$|" + |
| 97 | c.PS_FLUSH, False, False) |
| 98 | # output raw response from printer |
| 99 | output().raw(str_recv, "") |
| 100 | # break on postscript error message |
| 101 | if re.search(c.PS_FLUSH, str_recv): |
| 102 | break |
| 103 | # fetch user input and send it to postscript shell |
| 104 | self.send(eval(input("")) + "\n") |
| 105 | # handle CTRL+C and exceptions |
| 106 | except (EOFError, KeyboardInterrupt) as e: |
| 107 | pass |
| 108 | # reconnect with new conn object |
| 109 | self.reconnect(None) |
| 110 | |
| 111 | # -------------------------------------------------------------------- |
| 112 | # check if remote volume exists |