Factor out pty wrapper struct
This commit is contained in:
parent
40ed59e068
commit
575881c508
|
@ -1,5 +1,4 @@
|
|||
´³bundle·µ³pty„´³schema·³version°³definitions·³PtySize´³rec´³lit³pty-size„´³tupleµ´³named³id³any„´³named³columns´³atom³
SignedInteger„„´³named³rows´³atom³
SignedInteger„„„„„³PtyInput´³rec´³lit³ pty-input„´³tupleµ´³named³id³any„´³named³data´³atom³
|
||||
ByteString„„„„„³ PtyOutput´³rec´³lit³
|
||||
pty-output„´³tupleµ´³named³id³any„´³named³data´³atom³
|
||||
ByteString„„„„„³
|
||||
PtySession´³rec´³lit³pty-session„´³tupleµ´³named³id³any„´³named³commandLine´³refµ„³CommandLine„„„„„³CommandLine´³tuplePrefixµ´³named³command³any„„´³named³args´³seqof³any„„„³PtySessionRunning´³rec´³lit³pty-session-running„´³tupleµ´³named³id³any„„„„„³embeddedType€„„„„
|
||||
´³bundle·µ³pty„´³schema·³version°³definitions·³PtyInput´³rec´³lit³pty„´³tupleµ´³named³id³any„´³rec´³lit³input„´³tupleµ´³named³data´³atom³
|
||||
ByteString„„„„„„„„³ PtyOutput´³rec´³lit³pty„´³tupleµ´³named³id³any„´³rec´³lit³output„´³tupleµ´³named³data´³atom³
|
||||
ByteString„„„„„„„„³ PtyResize´³rec´³lit³pty„´³tupleµ´³named³id³any„´³rec´³lit³resize„´³tupleµ´³named³columns´³atom³
SignedInteger„„´³named³rows´³atom³
SignedInteger„„„„„„„„³
|
||||
PtySession´³rec´³lit³pty„´³tupleµ´³named³id³any„´³rec´³lit³command„´³tupleµ´³named³commandLine´³refµ„³CommandLine„„„„„„„„³CommandLine´³tuplePrefixµ´³named³command³any„„´³named³args´³seqof³any„„„³PtySessionRunning´³rec´³lit³pty„´³tupleµ´³named³id³any„´³rec´³lit³session-running„´³tupleµ„„„„„„„³embeddedType€„„„„
|
|
@ -13,7 +13,7 @@ version 1 .
|
|||
# (via SIGHUP first, SIGTERM if that doesn't work, and ultimately SIGKILL)
|
||||
# and close the associated PTY.
|
||||
#
|
||||
PtySession = <pty-session @id any @commandLine CommandLine> .
|
||||
PtySession = <pty @id any <command @commandLine CommandLine>> .
|
||||
#
|
||||
# A CommandLine is a non-empty sequence of pieces which, "stringified",
|
||||
# will form the command line used to create a subprocess. Each element of
|
||||
|
@ -28,13 +28,13 @@ CommandLine = [@command any @args any ...] .
|
|||
# Asserted by the driver when a PtySession request has resulted in a
|
||||
# running and ready session.
|
||||
#
|
||||
PtySessionRunning = <pty-session-running @id any> .
|
||||
PtySessionRunning = <pty @id any <session-running>> .
|
||||
|
||||
# Message. The driver interprets it as a request to execute TIOCSWINSZ.
|
||||
PtySize = <pty-size @id any @columns int @rows int> .
|
||||
PtyResize = <pty @id any <resize @columns int @rows int>> .
|
||||
|
||||
# Message. Causes `data` to be delivered by the driver to the subprocess via the pty.
|
||||
PtyInput = <pty-input @id any @data bytes> .
|
||||
PtyInput = <pty @id any <input @data bytes>> .
|
||||
|
||||
# Message. `data` was received by the driver from the subprocess via the pty.
|
||||
PtyOutput = <pty-output @id any @data bytes> .
|
||||
PtyOutput = <pty @id any <output @data bytes>> .
|
||||
|
|
|
@ -109,7 +109,7 @@ fn pty_session(t: &mut Activation, local_ds: Arc<Cap>, s: PtySession<AnyValue>)
|
|||
terminate_pid(t, &child_pid)
|
||||
}));
|
||||
|
||||
on_message!(t, local_ds, language(), <pty-input #(&s.id) $body>, |_t| {
|
||||
on_message!(t, local_ds, language(), <pty #(&s.id) <input $body>>, |_t| {
|
||||
match body.value().as_bytestring() {
|
||||
Some(bytes) => {
|
||||
tracing::trace!(?bytes, "sending to child");
|
||||
|
@ -121,7 +121,7 @@ fn pty_session(t: &mut Activation, local_ds: Arc<Cap>, s: PtySession<AnyValue>)
|
|||
Ok(())
|
||||
});
|
||||
|
||||
on_message!(t, local_ds, language(), <pty-size #(&s.id) $columns $rows>, |_t| {
|
||||
on_message!(t, local_ds, language(), <pty #(&s.id) <resize $columns $rows>>, |_t| {
|
||||
tracing::trace!(?columns, ?rows, "size change");
|
||||
let result = unsafe {
|
||||
libc::ioctl(child_fd, libc::TIOCSWINSZ, &libc::winsize {
|
||||
|
|
Loading…
Reference in New Issue