mirror of
https://github.com/asciinema/asciinema.git
synced 2025-12-16 19:58:03 +01:00
Include "x" (exit) event in ALiS stream
This commit is contained in:
13
src/alis.rs
13
src/alis.rs
@@ -137,5 +137,18 @@ fn serialize_event(event: Event, prev_event_time: u64) -> (Vec<u8>, u64) {
|
|||||||
|
|
||||||
(msg, time)
|
(msg, time)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Exit(id, time, status) => {
|
||||||
|
let id_bytes = leb128::encode(id);
|
||||||
|
let time_bytes = leb128::encode(time - prev_event_time);
|
||||||
|
let status_bytes = leb128::encode(status.max(0) as u64);
|
||||||
|
|
||||||
|
let mut msg = vec![b'x'];
|
||||||
|
msg.extend_from_slice(&id_bytes);
|
||||||
|
msg.extend_from_slice(&time_bytes);
|
||||||
|
msg.extend_from_slice(&status_bytes);
|
||||||
|
|
||||||
|
(msg, time)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ pub enum Event {
|
|||||||
Input(u64, u64, String),
|
Input(u64, u64, String),
|
||||||
Resize(u64, u64, TtySize),
|
Resize(u64, u64, TtySize),
|
||||||
Marker(u64, u64, String),
|
Marker(u64, u64, String),
|
||||||
|
Exit(u64, u64, i32),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Stream {
|
impl Stream {
|
||||||
@@ -112,7 +113,10 @@ async fn run(
|
|||||||
stream_time = time;
|
stream_time = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
session::Event::Exit(_time, _status) => {}
|
session::Event::Exit(time, status) => {
|
||||||
|
let _ = broadcast_tx.send(Event::Exit(last_event_id, time, status));
|
||||||
|
stream_time = time;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user