1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-07 06:22:47 -05:00

New facility, platform_start_subprocess.

We already have the ability to start a subprocess and hook it up to a
Socket, for running local proxy commands. Now the same facility is
available as an auxiliary feature, so that a backend can start another
subcommand for a different purpose, and make a separate Socket to
communicate with it.

Just like the local proxy system, this facility captures the
subprocess's stderr, and passes it back to the caller via plug_log. To
make that not look silly, I had to add a system where the "proxy:"
prefix on the usual plug_log messages is reconfigurable, and when you
call platform_start_subprocess(), you get to pass the prefix you want
to use in this case.
This commit is contained in:
Simon Tatham
2022-08-22 18:46:32 +01:00
parent a92aeca111
commit eec350c38b
11 changed files with 96 additions and 2 deletions

View File

@ -397,8 +397,10 @@ void backend_socket_log(Seat *seat, LogContext *logctx,
typedef struct ProxyStderrBuf {
char buf[8192];
size_t size;
const char *prefix; /* must be statically allocated */
} ProxyStderrBuf;
void psb_init(ProxyStderrBuf *psb);
void psb_set_prefix(ProxyStderrBuf *psb, const char *prefix);
void log_proxy_stderr(
Plug *plug, ProxyStderrBuf *psb, const void *vdata, size_t len);
@ -429,4 +431,6 @@ struct DeferredSocketOpenerVtable {
static inline void deferred_socket_opener_free(DeferredSocketOpener *dso)
{ dso->vt->free(dso); }
DeferredSocketOpener *null_deferred_socket_opener(void);
#endif