MCPcopy
hub / github.com/RUB-NDS/PRET / do_shell

Method do_shell

postscript.py:88–109  ·  view source on GitHub ↗

Open interactive PostScript shell.

(self, arg)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

outputClass · 0.90
infoMethod · 0.80
rawMethod · 0.80
searchMethod · 0.80
reconnectMethod · 0.80
sendMethod · 0.45
recvMethod · 0.45

Tested by

no test coverage detected