mirror of
https://github.com/nushell/nushell
synced 2024-12-27 05:23:11 +00:00
use constant instead of <0 for ls fix (#11642)
https://github.com/nushell/nushell/pull/10558#issuecomment-1911076784 more correct than <0. safer check.
This commit is contained in:
parent
86dd045554
commit
14e4d05a9f
1 changed files with 5 additions and 7 deletions
|
@ -632,7 +632,9 @@ fn try_convert_to_local_date_time(t: SystemTime) -> Option<DateTime<Local>> {
|
|||
}
|
||||
};
|
||||
|
||||
if sec < 0 {
|
||||
const NEG_UNIX_EPOCH: i64 = -11644473600; // t was invalid 0, UNIX_EPOCH subtracted above.
|
||||
if sec == NEG_UNIX_EPOCH {
|
||||
// do not tz lookup invalid SystemTime
|
||||
return None;
|
||||
}
|
||||
match Utc.timestamp_opt(sec, nsec) {
|
||||
|
@ -680,14 +682,10 @@ mod windows_helper {
|
|||
let find_data = match find_first_file(filename, span) {
|
||||
Ok(fd) => fd,
|
||||
Err(e) => {
|
||||
// Sometimes this happens when the file name is not allowed on Windows (ex: ends with a '.')
|
||||
// Sometimes this happens when the file name is not allowed on Windows (ex: ends with a '.', pipes)
|
||||
// For now, we just log it and give up on returning metadata columns
|
||||
// TODO: find another way to get this data (like cmd.exe, pwsh, and MINGW bash can)
|
||||
// eprintln!(
|
||||
// "Failed to read metadata for '{}'. It may have an illegal filename",
|
||||
// filename.to_string_lossy()
|
||||
// );
|
||||
log::error!("ls: {e}");
|
||||
log::error!("ls: '{}' {}", filename.to_string_lossy(), e);
|
||||
return Value::record(record, span);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue