Skip to content

Commit

Permalink
Support use /dev/stdin 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 authored and imeoer committed Aug 29, 2023
1 parent 847725c commit 37f9af8
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 @@ -1345,9 +1345,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 All @@ -1364,3 +1365,12 @@ impl Command {
Ok(())
}
}

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

0 comments on commit 37f9af8

Please sign in to comment.