Merge nucleic/brisk-yarn-dingo-50se into dev
This commit is contained in:
@@ -43,6 +43,10 @@ enum Event {
|
||||
cwd: String,
|
||||
exit_code: i32,
|
||||
duration_ms: u64,
|
||||
/// Present only for a command running as a stage of `a | b | c`; omitted
|
||||
/// otherwise so a standalone command's event keeps its old shape.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pipeline: Option<PipelineRef>,
|
||||
},
|
||||
#[serde(rename = "cd", rename_all = "camelCase")]
|
||||
Cd { seq: u64, ts: u64, from: String, to: String },
|
||||
@@ -98,6 +102,27 @@ enum Event {
|
||||
Dropped { seq: u64, ts: u64, count: u64 },
|
||||
}
|
||||
|
||||
/// The pipeline stage an exec event belongs to (docs/NASH.md §5.1). `id` is the same
|
||||
/// counter the `pipe` events carry, so the host can name the commands either side of
|
||||
/// a link instead of showing bare stage indices.
|
||||
#[derive(Serialize, Clone, Copy)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct PipelineRef {
|
||||
id: u64,
|
||||
index: u64,
|
||||
len: u64,
|
||||
}
|
||||
|
||||
impl From<brush_core::gate::PipelineSlot> for PipelineRef {
|
||||
fn from(slot: brush_core::gate::PipelineSlot) -> Self {
|
||||
Self {
|
||||
id: slot.id,
|
||||
index: slot.index as u64,
|
||||
len: slot.len as u64,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
struct Batch<'a> {
|
||||
@@ -190,6 +215,7 @@ struct PendingExec {
|
||||
cwd: PathBuf,
|
||||
started: Instant,
|
||||
redirects: Vec<brush_core::gate::RedirectRecord>,
|
||||
pipeline: Option<brush_core::gate::PipelineSlot>,
|
||||
}
|
||||
|
||||
struct Observer {
|
||||
@@ -368,6 +394,7 @@ impl brush_core::gate::Gate for RecordingGate {
|
||||
cwd: ev.cwd,
|
||||
started: Instant::now(),
|
||||
redirects: ev.redirects,
|
||||
pipeline: ev.pipeline,
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -433,6 +460,7 @@ impl brush_core::gate::Gate for RecordingGate {
|
||||
cwd: cwd_str,
|
||||
exit_code: ev.exit_code,
|
||||
duration_ms: u64::try_from(pending.started.elapsed().as_millis()).unwrap_or(0),
|
||||
pipeline: pending.pipeline.map(PipelineRef::from),
|
||||
});
|
||||
|
||||
// Data-flow read-back for this command's redirects (docs/NASH.md §5.2).
|
||||
|
||||
Reference in New Issue
Block a user