Skip to content

Commit

Permalink
Minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
hniksic committed Oct 24, 2020
1 parent f9a3476 commit 9edfc84
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/communicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@ mod raw {
// close stdin when done writing, so the child receives EOF
self.stdin.take();
// deallocate the input data, we don't need it any more
self.input_data.clear();
self.input_data.shrink_to_fit();
self.input_data = Vec::new();
}
}
if out_ready {
Expand Down
12 changes: 6 additions & 6 deletions src/popen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ mod os {
let cmd_to_exec = config.executable.as_ref().unwrap_or(&argv[0]);
let just_exec = posix::stage_exec(
cmd_to_exec,
&argv[..],
&argv,
child_env.as_deref(),
)?;
unsafe {
Expand All @@ -710,7 +710,7 @@ mod os {
let result = Popen::do_exec(
just_exec,
child_ends,
config.cwd.as_ref().map(|x| &x[..]),
config.cwd.as_deref(),
config.setuid,
config.setgid,
);
Expand Down Expand Up @@ -987,7 +987,7 @@ mod os {
executable.as_ref().map(OsString::as_ref),
&cmdline,
&env_block,
&config.cwd.as_ref().map(|os| &os[..]),
&config.cwd.as_deref(),
true,
0,
raw(&child_stdin),
Expand Down Expand Up @@ -1089,7 +1089,7 @@ mod os {
block
}

trait PopenOsImpl: super::PopenOs {
trait PopenOsImpl {
fn wait_handle(&mut self, timeout: Option<Duration>) -> io::Result<Option<ExitStatus>>;
}

Expand Down Expand Up @@ -1264,7 +1264,7 @@ fn get_standard_stream(which: StandardStream) -> io::Result<Rc<File>> {
#[derive(Debug)]
#[non_exhaustive]
pub enum PopenError {
/// The underlying error is io::Error.
/// An IO system call failed while executing the requested operation.
IoError(io::Error),
/// A logical error was made, e.g. invalid arguments detected at run-time.
LogicError(&'static str),
Expand All @@ -1285,7 +1285,7 @@ impl From<communicate::CommunicateError> for PopenError {
impl Error for PopenError {
fn source(&self) -> Option<&(dyn Error + 'static)> {
match *self {
PopenError::IoError(ref err) => Some(err as &dyn Error),
PopenError::IoError(ref err) => Some(err),
PopenError::LogicError(_msg) => None,
}
}
Expand Down
1 change: 0 additions & 1 deletion src/posix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use std::ptr;
use std::rc::Rc;
use std::time::{Duration, Instant};

use libc;
use libc::{c_char, c_int};

use crate::os_common::{ExitStatus, StandardStream};
Expand Down

0 comments on commit 9edfc84

Please sign in to comment.