mirror of
https://github.com/nushell/nushell.git
synced 2025-07-13 12:56:22 +02:00
# User-Facing Changes A new optional compile-time `selinux` feature (requires `libselinux`) enables `ls --context` and `ps --context` to show the security contexts of file entries and processes.
14 lines
571 B
Rust
14 lines
571 B
Rust
#[cfg(all(feature = "selinux", target_os = "linux"))]
|
|
#[test]
|
|
fn returns_correct_security_context() {
|
|
use nu_test_support::nu_with_std;
|
|
|
|
let input = "
|
|
use std assert
|
|
^ps -o pid=,label= | lines | each { str trim | split column ' ' 'pid' 'procps_scontext' } | flatten \
|
|
| join (ps -Z | each { default '-' security_context }) pid \
|
|
| each { |e| assert equal $e.security_context $e.procps_scontext $'For process ($e.pid) expected ($e.procps_scontext), got ($e.security_context)' }
|
|
";
|
|
assert_eq!(nu_with_std!(input).err, "");
|
|
}
|