Skip to content

Commit 1d57da7

Browse files
committed
Handle fallout in libnative
API Changes: - GetAddrInfoRequest::run() returns Result<Vec<..>, ..> - Process::spawn() returns Result(.., Vec<..>), ..>
1 parent a99eff3 commit 1d57da7

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/libnative/io/addrinfo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub struct GetAddrInfoRequest;
2222

2323
impl GetAddrInfoRequest {
2424
pub fn run(host: Option<&str>, servname: Option<&str>,
25-
hint: Option<ai::Hint>) -> Result<~[ai::Info], IoError> {
25+
hint: Option<ai::Hint>) -> Result<Vec<ai::Info>, IoError> {
2626
assert!(host.is_some() || servname.is_some());
2727

2828
let c_host = host.map_or(unsafe { CString::new(null(), true) }, |x| x.to_c_str());
@@ -80,7 +80,7 @@ impl GetAddrInfoRequest {
8080

8181
unsafe { freeaddrinfo(res); }
8282

83-
Ok(addrs.move_iter().collect())
83+
Ok(addrs)
8484
}
8585
}
8686

src/libnative/io/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ impl rtio::IoFactory for IoFactory {
194194
})
195195
}
196196
fn get_host_addresses(&mut self, host: Option<&str>, servname: Option<&str>,
197-
hint: Option<ai::Hint>) -> IoResult<~[ai::Info]> {
197+
hint: Option<ai::Hint>) -> IoResult<Vec<ai::Info>> {
198198
addrinfo::GetAddrInfoRequest::run(host, servname, hint)
199199
}
200200

@@ -260,7 +260,7 @@ impl rtio::IoFactory for IoFactory {
260260
}
261261
fn spawn(&mut self, config: ProcessConfig)
262262
-> IoResult<(Box<RtioProcess:Send>,
263-
~[Option<Box<RtioPipe:Send>>])> {
263+
Vec<Option<Box<RtioPipe:Send>>>)> {
264264
process::Process::spawn(config).map(|(p, io)| {
265265
(box p as Box<RtioProcess:Send>,
266266
io.move_iter().map(|p| p.map(|p| {

src/libnative/io/process.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl Process {
6767
/// os pipe instead. This process takes ownership of these file
6868
/// descriptors, closing them upon destruction of the process.
6969
pub fn spawn(config: p::ProcessConfig)
70-
-> Result<(Process, ~[Option<file::FileDesc>]), io::IoError>
70+
-> Result<(Process, Vec<Option<file::FileDesc>>), io::IoError>
7171
{
7272
// right now we only handle stdin/stdout/stderr.
7373
if config.extra_io.len() > 0 {
@@ -117,7 +117,7 @@ impl Process {
117117
exit_code: None,
118118
exit_signal: None,
119119
},
120-
ret_io.move_iter().collect()))
120+
ret_io))
121121
}
122122
Err(e) => Err(e)
123123
}

src/libstd/rt/rtio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ pub trait IoFactory {
191191
fn timer_init(&mut self) -> IoResult<Box<RtioTimer:Send>>;
192192
fn spawn(&mut self, config: ProcessConfig)
193193
-> IoResult<(Box<RtioProcess:Send>,
194-
~[Option<Box<RtioPipe:Send>>])>;
194+
Vec<Option<Box<RtioPipe:Send>>>)>;
195195
fn kill(&mut self, pid: libc::pid_t, signal: int) -> IoResult<()>;
196196
fn pipe_open(&mut self, fd: c_int) -> IoResult<Box<RtioPipe:Send>>;
197197
fn tty_open(&mut self, fd: c_int, readable: bool)

0 commit comments

Comments
 (0)