Skip to content

Commit 04a3935

Browse files
garethgareth
gareth
authored and
gareth
committed
Rename unwrap_input/unwrap_output as suggested by
@brson. Also fix a few documentation bugs.
1 parent 49a1ab8 commit 04a3935

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/libstd/run.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ pub struct Process {
4545
/// Some(fd), or None when stdin is being redirected from a fd not created by Process::new.
4646
priv input: Option<c_int>,
4747

48-
/// Some(fd), or None when stdout is being redirected to a fd not created by Process::new.
48+
/// Some(file), or None when stdout is being redirected to a fd not created by Process::new.
4949
priv output: Option<*libc::FILE>,
5050

51-
/// Some(fd), or None when stderr is being redirected to a fd not created by Process::new.
51+
/// Some(file), or None when stderr is being redirected to a fd not created by Process::new.
5252
priv error: Option<*libc::FILE>,
5353

5454
/// None until finish() is called.
@@ -191,23 +191,23 @@ pub impl Process {
191191
/// Returns the unique id of the process
192192
fn get_id(&self) -> pid_t { self.pid }
193193

194-
priv fn unwrap_input(&mut self) -> c_int {
194+
priv fn input_fd(&mut self) -> c_int {
195195
match self.input {
196196
Some(fd) => fd,
197197
None => fail!("This Process's stdin was redirected to an \
198198
existing file descriptor.")
199199
}
200200
}
201201

202-
priv fn unwrap_output(&mut self) -> *libc::FILE {
202+
priv fn output_file(&mut self) -> *libc::FILE {
203203
match self.output {
204204
Some(file) => file,
205205
None => fail!("This Process's stdout was redirected to an \
206206
existing file descriptor.")
207207
}
208208
}
209209

210-
priv fn unwrap_error(&mut self) -> *libc::FILE {
210+
priv fn error_file(&mut self) -> *libc::FILE {
211211
match self.error {
212212
Some(file) => file,
213213
None => fail!("This Process's stderr was redirected to an \
@@ -255,7 +255,7 @@ pub impl Process {
255255
*/
256256
fn input(&mut self) -> @io::Writer {
257257
// FIXME: the Writer can still be used after self is destroyed: #2625
258-
io::fd_writer(self.unwrap_input(), false)
258+
io::fd_writer(self.input_fd(), false)
259259
}
260260

261261
/**
@@ -265,7 +265,7 @@ pub impl Process {
265265
*/
266266
fn output(&mut self) -> @io::Reader {
267267
// FIXME: the Reader can still be used after self is destroyed: #2625
268-
io::FILE_reader(self.unwrap_output(), false)
268+
io::FILE_reader(self.output_file(), false)
269269
}
270270

271271
/**
@@ -275,7 +275,7 @@ pub impl Process {
275275
*/
276276
fn error(&mut self) -> @io::Reader {
277277
// FIXME: the Reader can still be used after self is destroyed: #2625
278-
io::FILE_reader(self.unwrap_error(), false)
278+
io::FILE_reader(self.error_file(), false)
279279
}
280280

281281
/**
@@ -341,8 +341,8 @@ pub impl Process {
341341
*/
342342
fn finish_with_output(&mut self) -> ProcessOutput {
343343

344-
let output_file = self.unwrap_output();
345-
let error_file = self.unwrap_error();
344+
let output_file = self.output_file();
345+
let error_file = self.error_file();
346346

347347
// Spawn two entire schedulers to read both stdout and sterr
348348
// in parallel so we don't deadlock while blocking on one
@@ -814,7 +814,7 @@ pub fn process_output(prog: &str, args: &[~str]) -> ProcessOutput {
814814
*
815815
* Note that this is private to avoid race conditions on unix where if
816816
* a user calls waitpid(some_process.get_id()) then some_process.finish()
817-
* and some_process.destroy() and some_process.drop() will then either
817+
* and some_process.destroy() and some_process.finalize() will then either
818818
* operate on a none-existant process or, even worse, on a newer process
819819
* with the same id.
820820
*/

0 commit comments

Comments
 (0)