Add a method for inhering the command-line arguments from the host.
This commit is contained in:
@@ -3,6 +3,7 @@ use crate::sys::dev_null;
|
||||
use crate::{host, Error, Result};
|
||||
use std::borrow::Borrow;
|
||||
use std::collections::HashMap;
|
||||
use std::env;
|
||||
use std::ffi::CString;
|
||||
use std::fs::File;
|
||||
use std::path::{Path, PathBuf};
|
||||
@@ -45,6 +46,11 @@ impl WasiCtxBuilder {
|
||||
Ok(self)
|
||||
}
|
||||
|
||||
/// Inherit the command-line arguments from the host process.
|
||||
pub fn inherit_args(self) -> Result<Self> {
|
||||
self.args(env::args())
|
||||
}
|
||||
|
||||
pub fn inherit_stdio(mut self) -> Result<Self> {
|
||||
self.fds.insert(0, FdEntry::duplicate_stdin()?);
|
||||
self.fds.insert(1, FdEntry::duplicate_stdout()?);
|
||||
|
||||
Reference in New Issue
Block a user