mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-17 10:23:15 +08:00
Implement builtin test in Rust
This implements (but does not yet adopt) builtin test in Rust.
This commit is contained in:
parent
a20985c738
commit
10a7de03e2
|
@ -15,5 +15,6 @@ pub mod pwd;
|
|||
pub mod random;
|
||||
pub mod realpath;
|
||||
pub mod r#return;
|
||||
pub mod test;
|
||||
pub mod r#type;
|
||||
pub mod wait;
|
||||
|
|
|
@ -100,6 +100,7 @@ pub struct io_streams_t {
|
|||
pub out: output_stream_t,
|
||||
pub err: output_stream_t,
|
||||
pub out_is_redirected: bool,
|
||||
pub err_is_redirected: bool,
|
||||
}
|
||||
|
||||
impl io_streams_t {
|
||||
|
@ -107,12 +108,14 @@ impl io_streams_t {
|
|||
let out = output_stream_t(streams.as_mut().get_out().unpin());
|
||||
let err = output_stream_t(streams.as_mut().get_err().unpin());
|
||||
let out_is_redirected = streams.as_mut().get_out_redirected();
|
||||
let err_is_redirected = streams.as_mut().get_err_redirected();
|
||||
let streams = streams.unpin();
|
||||
io_streams_t {
|
||||
streams,
|
||||
out,
|
||||
err,
|
||||
out_is_redirected,
|
||||
err_is_redirected,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
1090
fish-rust/src/builtins/test.rs
Normal file
1090
fish-rust/src/builtins/test.rs
Normal file
File diff suppressed because it is too large
Load Diff
1
src/io.h
1
src/io.h
|
@ -512,6 +512,7 @@ struct io_streams_t : noncopyable_t {
|
|||
output_stream_t &get_err() { return err; };
|
||||
io_streams_t(const io_streams_t &) = delete;
|
||||
bool get_out_redirected() { return out_is_redirected; };
|
||||
bool get_err_redirected() { return err_is_redirected; };
|
||||
bool ffi_stdin_is_directly_redirected() const { return stdin_is_directly_redirected; };
|
||||
int ffi_stdin_fd() const { return stdin_fd; };
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user