Skip to content

Commit 5ab14c8

Browse files
authored
Merge pull request #223 from blacknon/0.3.20
update. fixed job failed.
2 parents 533837a + 2b21a29 commit 5ab14c8

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/exec.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use flate2::{read::GzDecoder, write::GzEncoder};
1313
use nix::pty::{openpty, OpenptyResult, Winsize};
1414
#[cfg(unix)]
1515
use nix::sys::termios::{cfmakeraw, tcgetattr, tcsetattr, SetArg};
16+
#[cfg(unix)]
1617
use std::fs::File;
1718
use std::io::prelude::*;
1819
use std::io::BufReader;
@@ -337,7 +338,10 @@ fn exec_command(exec_commands: &[String], is_pty: bool) -> (bool, Vec<u8>, Vec<u
337338
let mut command = Command::new(&exec_commands[0]);
338339
command.args(&exec_commands[1..length]);
339340

340-
let mut stdin_master = None;
341+
#[cfg(unix)]
342+
let mut stdin_master: Option<OwnedFd> = None;
343+
#[cfg(not(unix))]
344+
let stdin_master: Option<()> = None;
341345
let stdout_reader;
342346
let stderr_reader;
343347

@@ -383,21 +387,23 @@ fn exec_command(exec_commands: &[String], is_pty: bool) -> (bool, Vec<u8>, Vec<u
383387

384388
let child_result = command.spawn();
385389
drop(command);
386-
drop(stdin_master);
390+
let _ = stdin_master;
387391
let mut vec_output = Vec::new();
388392
let mut vec_stdout = Vec::new();
389393
let mut vec_stderr = Vec::new();
390394

391395
let status = match child_result {
392396
Ok(mut child) => {
393397
let stdout_thread = match stdout_reader {
398+
#[cfg(unix)]
394399
ReaderHandle::Fd(fd) => thread::spawn(move || read_from_fd(fd, "stdout")),
395400
ReaderHandle::Pipe => {
396401
let child_stdout = child.stdout.take().expect("");
397402
thread::spawn(move || read_from_pipe(child_stdout, "stdout"))
398403
}
399404
};
400405
let stderr_thread = match stderr_reader {
406+
#[cfg(unix)]
401407
ReaderHandle::Fd(fd) => thread::spawn(move || read_from_fd(fd, "stderr")),
402408
ReaderHandle::Pipe => {
403409
let child_stderr = child.stderr.take().expect("");

0 commit comments

Comments
 (0)