chickadee » minissh » with-channel-ports

channel-input-port channelprocedure
channel-output-port channelprocedure
channel-error-port channelprocedure
with-channel-ports channel thunkprocedure
with-channel-ports* channel thunkprocedure

Wrap channel calls into ports. channel-input-port does (channel-read channel) and ignores the extended data index, so it cannot distinguish between stdout and stderr. channel-output-port does (channel-write channel str) and channel-error-port does (channel-write ch 'stderr).

with-channel-ports calls thunk with current-input-port and current-output-port bound to channels's ports. with-channel-ports* also wraps current-error-port. This may sometimes cause problems as runtime errors are printed onto channels's stderr.