Skip to content

Commit

Permalink
Support use /proc/self/fd/0 as SOURCE path for image build
Browse files Browse the repository at this point in the history
Signed-off-by: zyfjeff <[email protected]>
  • Loading branch information
zyfjeff committed Aug 29, 2023
1 parent 1abf0ae commit cfade1b
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/bin/nydus-image/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1695,9 +1695,10 @@ impl Command {
let file_type = metadata(path.as_ref())
.context(format!("failed to access path {:?}", path.as_ref()))?
.file_type();
// The SOURCE can be a regular file, FIFO file, or /dev/stdin char device, etc..
ensure!(
file_type.is_file() || file_type.is_fifo(),
"specified path must be a regular/fifo file: {:?}",
file_type.is_file() || file_type.is_fifo() || file_type.is_char_device(),
"specified path must be a regular/fifo/char_device file: {:?}",
path.as_ref()
);
Ok(())
Expand Down Expand Up @@ -1804,3 +1805,12 @@ impl Command {
nydus_service::validate_threads_configuration(v).map(|s| s.to_string())
}
}

#[cfg(test)]
mod tests {
use super::Command;
#[test]
fn test_ensure_file() {
Command::ensure_file("/dev/stdin").unwrap();
}
}

0 comments on commit cfade1b

Please sign in to comment.