Skip to content

Commit

Permalink
Merge pull request #31 from BeldrothTheGold/spell-check
Browse files Browse the repository at this point in the history
  • Loading branch information
philippkeller authored Nov 15, 2020
2 parents 8999649 + 58f6f2f commit db3b17d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl PtyProcess {
self.kill_timeout = timeout_ms.and_then(|millis| Some(time::Duration::from_millis(millis)));
}

/// Get status of child process, nonblocking.
/// Get status of child process, non-blocking.
///
/// This method runs waitpid on the process.
/// This means: If you ran `exit()` before or `status()` this method will
Expand Down Expand Up @@ -187,7 +187,7 @@ impl PtyProcess {
self.kill(signal::SIGTERM)
}

/// Nonblocking variant of `kill()` (doesn't wait for process to be killed)
/// Non-blocking variant of `kill()` (doesn't wait for process to be killed)
pub fn signal(&mut self, sig: signal::Signal) -> Result<()> {
signal::kill(self.child_pid, sig)
.chain_err(|| "failed to send signal to process")?;
Expand All @@ -198,7 +198,7 @@ impl PtyProcess {
///
/// repeatedly sends SIGTERM to the process until it died,
/// the pty session is closed upon dropping PtyMaster,
/// so we don't need to explicitely do that here.
/// so we don't need to explicitly do that here.
///
/// if `kill_timeout` is set and a repeated sending of signal does not result in the process
/// being killed, then `kill -9` is sent after the `kill_timeout` duration has elapsed.
Expand Down
4 changes: 2 additions & 2 deletions src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ impl NBReader {
/// - f: file like object
/// - timeout:
/// + `None`: read_until is blocking forever. This is probably not what you want
/// + `Some(millis)`: after millis millisecons a timeout error is raised
/// + `Some(millis)`: after millis milliseconds a timeout error is raised
pub fn new<R: Read + Send + 'static>(f: R, timeout: Option<u64>) -> NBReader {
let (tx, rx) = channel();

Expand Down Expand Up @@ -257,7 +257,7 @@ impl NBReader {
}

/// Try to read one char from internal buffer. Returns None if
/// no char is ready, Some(char) otherwise. This is nonblocking
/// no char is ready, Some(char) otherwise. This is non-blocking
pub fn try_read(&mut self) -> Option<char> {
// discard eventual errors, EOF will be handled in read_until correctly
let _ = self.read_into_buffer();
Expand Down
12 changes: 6 additions & 6 deletions src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl<W: Write> StreamSession<W> {
}

/// Return `Some(c)` if a char is ready in the stdout stream of the process, return `None`
/// otherwise. This is nonblocking.
/// otherwise. This is non-blocking.
pub fn try_read(&mut self) -> Option<char> {
self.reader.try_read()
}
Expand Down Expand Up @@ -206,14 +206,14 @@ impl DerefMut for PtySession {
/// ```
impl PtySession {
fn new(process: PtyProcess, timeout_ms: Option<u64>, commandname: String) -> Result<Self> {

let f = process.get_file_handle();
let reader = f.try_clone().chain_err(|| "couldn't open write stream")?;
let stream = StreamSession::new(reader, f, timeout_ms);
Ok(Self {
process,
stream,
commandname: commandname,
commandname,
})
}
}
Expand All @@ -236,9 +236,9 @@ fn tokenize_command(program: &str) -> Vec<String> {
///
/// - `program`: This is split at spaces and turned into a `process::Command`
/// if you wish more control over this, use `spawn_command`
/// - `timeout`: If Some: all `exp_*` commands time out after x millisecons, if None: never times
/// - `timeout`: If Some: all `exp_*` commands time out after x milliseconds, if None: never times
/// out.
/// It's higly recommended to put a timeout there, as otherwise in case of
/// It's highly recommended to put a timeout there, as otherwise in case of
/// a problem the program just hangs instead of exiting with an
/// error message indicating where it stopped.
/// For automation 30'000 (30s, the default in pexpect) is a good value.
Expand Down Expand Up @@ -540,7 +540,7 @@ mod tests {
p.execute("cat <(echo ready) -", "ready")?;
Ok(())
}().unwrap_or_else(|e| panic!("test_kill_timeout failed: {}", e));
// p is dropped here and kill is sent immediatly to bash
// p is dropped here and kill is sent immediately to bash
// Since that is not enough to make bash exit, a kill -9 is sent within 1s (timeout)
}

Expand Down

0 comments on commit db3b17d

Please sign in to comment.