Skip to content

Commit 801dede

Browse files
committed
redact shell path (.../cmd.exe) before extension (.exe)
1 parent 458bf20 commit 801dede

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

  • crates/vite_task_plan/tests/plan_snapshots

crates/vite_task_plan/tests/plan_snapshots/redact.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,21 +93,6 @@ pub fn redact_snapshot(value: &impl Serialize, workspace_root: &str) -> serde_js
9393
}
9494
});
9595

96-
// Normalize Windows program names and paths by stripping common extensions for cross-platform consistency
97-
visit_json(&mut json_value, &mut |v| {
98-
let serde_json::Value::Object(map) = v else {
99-
return;
100-
};
101-
// Normalize program_name field
102-
if let Some(serde_json::Value::String(program_name)) = map.get_mut("program_name") {
103-
strip_windows_executable_extension(program_name);
104-
}
105-
// Normalize program_path field
106-
if let Some(serde_json::Value::String(program_path)) = map.get_mut("program_path") {
107-
strip_windows_executable_extension(program_path);
108-
}
109-
});
110-
11196
// Redact shell program and arguments for cross-platform consistency
11297
let os_shell_path = if cfg!(windows) { "C:\\Windows\\System32\\cmd.exe" } else { "/bin/sh" };
11398
let os_shell_name = if cfg!(windows) { "cmd" } else { "sh" };
@@ -132,6 +117,21 @@ pub fn redact_snapshot(value: &impl Serialize, workspace_root: &str) -> serde_js
132117
}
133118
});
134119

120+
// Normalize Windows program names and paths by stripping common extensions for cross-platform consistency
121+
visit_json(&mut json_value, &mut |v| {
122+
let serde_json::Value::Object(map) = v else {
123+
return;
124+
};
125+
// Normalize program_name field
126+
if let Some(serde_json::Value::String(program_name)) = map.get_mut("program_name") {
127+
strip_windows_executable_extension(program_name);
128+
}
129+
// Normalize program_path field
130+
if let Some(serde_json::Value::String(program_path)) = map.get_mut("program_path") {
131+
strip_windows_executable_extension(program_path);
132+
}
133+
});
134+
135135
visit_json(&mut json_value, &mut |v| {
136136
let serde_json::Value::Array(array) = v else {
137137
return;

0 commit comments

Comments
 (0)