MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / create_pty_terminal

Function create_pty_terminal

web/pgadmin/tools/psql/__init__.py:175–200  ·  view source on GitHub ↗
(connection_data, server_id)

Source from the content-addressed store, hash-verified

173
174
175def create_pty_terminal(connection_data, server_id):
176 # Create the pty terminal process, parent and fd are file descriptors
177 # for parent and child.
178 parent, fd = pty.openpty()
179 p = None
180 if parent is not None:
181 # Child process
182 p = subprocess.Popen(connection_data,
183 preexec_fn=os.setsid,
184 stdin=fd,
185 stdout=fd,
186 stderr=fd,
187 universal_newlines=True,
188 env=get_user_env()
189 )
190
191 app.config['sessions'][request.sid] = parent
192 pdata[request.sid] = p
193 cdata[request.sid] = fd
194 open_psql_connections[request.sid] = server_id
195 else:
196 app.config['sessions'][request.sid] = parent
197 cdata[request.sid] = fd
198 set_term_size(fd, 50, 50)
199
200 return p, parent, fd
201
202
203def read_terminal_data(parent, data_ready, max_read_bytes, sid):

Callers 1

pty_handel_ioFunction · 0.85

Calls 2

get_user_envFunction · 0.85
set_term_sizeFunction · 0.85

Tested by

no test coverage detected