Skip to content

Commit 52985bf

Browse files
lakewabancloudxiao
authored andcommitted
fix(ls): force LC_TIME=C for locale-independent date parsing
The LS_DATE_RE regex expects English month names (Jan, Feb, etc.), but ls -la output uses numeric months (5, 6, etc.) when the user's locale sets LC_TIME to a non-English language. This causes parse_ls_line() to fail on every line, making rtk ls always return '(empty)' on such systems (e.g. Chinese locale). Fix by setting LC_TIME=C before executing ls, ensuring the date format is always 'May 3 12:23' regardless of system locale. Fixes #(issue number if known)
1 parent 4338f02 commit 52985bf

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/cmds/system/ls.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ pub fn run(args: &[String], verbose: u8) -> Result<i32> {
3636

3737
let mut cmd = resolved_command("ls");
3838
cmd.arg("-la");
39+
// Force English date format so LS_DATE_RE can parse the output reliably,
40+
// regardless of the user's locale/LC_TIME setting.
41+
cmd.env("LC_TIME", "C");
3942
for flag in &flags {
4043
if flag.starts_with("--") {
4144
if *flag != "--all" {

0 commit comments

Comments
 (0)