mirror of
https://github.com/nushell/nushell.git
synced 2024-11-25 18:03:51 +01:00
e43d893ea3
wrap chrono in panic hooks to handle panic'ing unwraps on Jan 1, 1601 00:00 UTC and other reasons unknown. An overflow if time_u64 is smaller than EPOCH_AS_FILETIME has been wrapped. Further discussion https://github.com/nushell/nushell/issues/10464 There are two issues that are associated with Chrono. I did not test. It may not relate, but it could. thread 'main' panicked at 'SystemTimeToFileTime failed with: The parameter is incorrect. https://github.com/nushell/nushell/issues/6574 https://github.com/nushell/nushell/issues/9470 # Description I'm not a fan of this code that was pulled from chrono. negative seconds and nano seconds? ```rust // Adapted from https://github.com/chronotope/chrono/blob/v0.4.19/src/datetime.rs#L755-L767. let (sec, nsec, was_success) = match t.duration_since(UNIX_EPOCH) { Ok(dur) => { (dur.as_secs() as i64, dur.subsec_nanos(),true) }, Err(e) => { // unlikely but should be handled let dur = e.duration(); let (sec, nsec) = (dur.as_secs() as i64, dur.subsec_nanos()); if nsec == 0 { (-sec, 0,false) } else { (-sec - 1, 1_000_000_000 - nsec,false) } } }; ``` There's more on the #10464 ticket; # User-Facing Changes Use ls and it will not crash when listing windows pipes ls \\.\pipe. # Tests + Formatting - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) DONE - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style that command yields: ```rust error: casting raw pointers to the same type and constness is unnecessary (`*mut u16` -> `*mut u16`) --> crates\nu-system\src\windows.rs:972:13 | 972 | name.as_mut_ptr() as *mut u16, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `name.as_mut_ptr()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast = note: `-D clippy::unnecessary-cast` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::unnecessary_cast)]` error: casting raw pointers to the same type and constness is unnecessary (`*mut u16` -> `*mut u16`) --> crates\nu-system\src\windows.rs:974:13 | 974 | domainname.as_mut_ptr() as *mut u16, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `domainname.as_mut_ptr()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast error: could not compile `nu-system` (lib) due to 2 previous errors ``` TBD - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use std testing; testing run-tests --path crates/nu-std"` to run the tests for the standard library |
||
---|---|---|
.. | ||
nu_plugin_custom_values | ||
nu_plugin_example | ||
nu_plugin_formats | ||
nu_plugin_gstat | ||
nu_plugin_inc | ||
nu_plugin_python | ||
nu_plugin_query | ||
nu-cli | ||
nu-cmd-base | ||
nu-cmd-dataframe | ||
nu-cmd-extra | ||
nu-cmd-lang | ||
nu-color-config | ||
nu-command | ||
nu-engine | ||
nu-explore | ||
nu-glob | ||
nu-json | ||
nu-lsp | ||
nu-parser | ||
nu-path | ||
nu-plugin | ||
nu-pretty-hex | ||
nu-protocol | ||
nu-std | ||
nu-system | ||
nu-table | ||
nu-term-grid | ||
nu-test-support | ||
nu-utils | ||
README.md |
Nushell core libraries and plugins
These sub-crates form both the foundation for Nu and a set of plugins which extend Nu with additional functionality.
Foundational libraries are split into two kinds of crates:
- Core crates - those crates that work together to build the Nushell language engine
- Support crates - a set of crates that support the engine with additional features like JSON support, ANSI support, and more.
Plugins are likewise also split into two types:
- Core plugins - plugins that provide part of the default experience of Nu, including access to the system properties, processes, and web-connectivity features.
- Extra plugins - these plugins run a wide range of different capabilities like working with different file types, charting, viewing binary data, and more.