Handle fallout in libnative
API Changes: - GetAddrInfoRequest::run() returns Result<Vec<..>, ..> - Process::spawn() returns Result(.., Vec<..>), ..>
This commit is contained in:
parent
a99eff3fca
commit
1d57da783b
@ -22,7 +22,7 @@ pub struct GetAddrInfoRequest;
|
||||
|
||||
impl GetAddrInfoRequest {
|
||||
pub fn run(host: Option<&str>, servname: Option<&str>,
|
||||
hint: Option<ai::Hint>) -> Result<~[ai::Info], IoError> {
|
||||
hint: Option<ai::Hint>) -> Result<Vec<ai::Info>, IoError> {
|
||||
assert!(host.is_some() || servname.is_some());
|
||||
|
||||
let c_host = host.map_or(unsafe { CString::new(null(), true) }, |x| x.to_c_str());
|
||||
@ -80,7 +80,7 @@ impl GetAddrInfoRequest {
|
||||
|
||||
unsafe { freeaddrinfo(res); }
|
||||
|
||||
Ok(addrs.move_iter().collect())
|
||||
Ok(addrs)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -194,7 +194,7 @@ impl rtio::IoFactory for IoFactory {
|
||||
})
|
||||
}
|
||||
fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>,
|
||||
hint: Option<ai::Hint>) -> IoResult<~[ai::Info]> {
|
||||
hint: Option<ai::Hint>) -> IoResult<Vec<ai::Info>> {
|
||||
addrinfo::GetAddrInfoRequest::run(host, servname, hint)
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ impl rtio::IoFactory for IoFactory {
|
||||
}
|
||||
fn spawn(&mut self, config: ProcessConfig)
|
||||
-> IoResult<(Box<RtioProcess:Send>,
|
||||
~[Option<Box<RtioPipe:Send>>])> {
|
||||
Vec<Option<Box<RtioPipe:Send>>>)> {
|
||||
process::Process::spawn(config).map(|(p, io)| {
|
||||
(box p as Box<RtioProcess:Send>,
|
||||
io.move_iter().map(|p| p.map(|p| {
|
||||
|
@ -67,7 +67,7 @@ impl Process {
|
||||
/// os pipe instead. This process takes ownership of these file
|
||||
/// descriptors, closing them upon destruction of the process.
|
||||
pub fn spawn(config: p::ProcessConfig)
|
||||
-> Result<(Process, ~[Option<file::FileDesc>]), io::IoError>
|
||||
-> Result<(Process, Vec<Option<file::FileDesc>>), io::IoError>
|
||||
{
|
||||
// right now we only handle stdin/stdout/stderr.
|
||||
if config.extra_io.len() > 0 {
|
||||
@ -117,7 +117,7 @@ impl Process {
|
||||
exit_code: None,
|
||||
exit_signal: None,
|
||||
},
|
||||
ret_io.move_iter().collect()))
|
||||
ret_io))
|
||||
}
|
||||
Err(e) => Err(e)
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ pub trait IoFactory {
|
||||
fn timer_init(&mut self) -> IoResult<Box<RtioTimer:Send>>;
|
||||
fn spawn(&mut self, config: ProcessConfig)
|
||||
-> IoResult<(Box<RtioProcess:Send>,
|
||||
~[Option<Box<RtioPipe:Send>>])>;
|
||||
Vec<Option<Box<RtioPipe:Send>>>)>;
|
||||
fn kill(&mut self, pid: libc::pid_t, signal: int) -> IoResult<()>;
|
||||
fn pipe_open(&mut self, fd: c_int) -> IoResult<Box<RtioPipe:Send>>;
|
||||
fn tty_open(&mut self, fd: c_int, readable: bool)
|
||||
|
Loading…
Reference in New Issue
Block a user