<commit_before>use libc::c_int;
use libc;
use result::ShellError;
use result::ShellResult;
use std::mem;
use std::sync::Arc;
use std::sync::RwLock;
use result::check_errno;
use result::ShellResultExt;
use std::process::Child;
use std::process::Command;
use local_shell::current_shell;
use std::io::Read;

#[derive(Debug)]
pub struct ShellChildCore {
    command_line: String,
    child: Child,
    has_group: bool
}

impl ShellChildCore {
    fn new(command_line: String, child: Child,
           has_group: bool) -> ShellChildCore {
        ShellChildCore {
            command_line: command_line,
            child: child,
            has_group: has_group
        }
    }

    pub fn signal(&self, sig: c_int) -> ShellResult {
        let kill_pid = if self.has_group {
            -(self.child.id() as i32)
        } else {
            self.child.id() as i32
        };

        info!("Sending signal {} to {}", sig, self.child.id());
        unsafe {
            check_errno("kill", libc::kill(kill_pid, sig))?;
        }
        Ok(())
    }

    pub fn wait_null(&self) -> ShellResult {
        unsafe {
            let mut info = mem::uninitialized::<libc::siginfo_t>();
            check_errno("waitid",
                        libc::waitid(
                            libc::P_PID,
                            self.child.id() as u32,
                            &mut info as *mut libc::siginfo_t,
                            libc::WEXITED | libc::WNOWAIT))?;
        }
        Ok(())
    }

    pub fn wait(mut self) -> ShellResult {
        ShellResult::from_status(self.command_line, self.child.wait()?)
    }
}

pub type ShellChildArc = Arc<RwLock<Option<ShellChildCore>>>;

/// Job which is a process leader.
/// This wraps Arc<RwLock<ShellChildCore>> and provides helper functions.
pub struct ShellChild(ShellChildArc);
<commit_msg>Mark Child in ShellChild public<commit_after>use libc::c_int;
use libc;
use result::ShellError;
use result::ShellResult;
use std::mem;
use std::sync::Arc;
use std::sync::RwLock;
use result::check_errno;
use result::ShellResultExt;
use std::process::Child;
use std::process::Command;
use local_shell::current_shell;
use std::io::Read;

#[derive(Debug)]
pub struct ShellChildCore {
    command_line: String,
    pub child: Child,
    has_group: bool
}

impl ShellChildCore {
    fn new(command_line: String, child: Child,
           has_group: bool) -> ShellChildCore {
        ShellChildCore {
            command_line: command_line,
            child: child,
            has_group: has_group
        }
    }

    pub fn signal(&self, sig: c_int) -> ShellResult {
        let kill_pid = if self.has_group {
            -(self.child.id() as i32)
        } else {
            self.child.id() as i32
        };

        info!("Sending signal {} to {}", sig, self.child.id());
        unsafe {
            check_errno("kill", libc::kill(kill_pid, sig))?;
        }
        Ok(())
    }

    pub fn wait_null(&self) -> ShellResult {
        unsafe {
            let mut info = mem::uninitialized::<libc::siginfo_t>();
            check_errno("waitid",
                        libc::waitid(
                            libc::P_PID,
                            self.child.id() as u32,
                            &mut info as *mut libc::siginfo_t,
                            libc::WEXITED | libc::WNOWAIT))?;
        }
        Ok(())
    }

    pub fn wait(mut self) -> ShellResult {
        ShellResult::from_status(self.command_line, self.child.wait()?)
    }
}

pub type ShellChildArc = Arc<RwLock<Option<ShellChildCore>>>;

/// Job which is a process leader.
/// This wraps Arc<RwLock<ShellChildCore>> and provides helper functions.
pub struct ShellChild(pub ShellChildArc);

{'fraction_non_alphanumeric': 0.12748789671866595, 'fraction_numerical': 0.0032275416890801506, 'mean_word_length': 2.143702451394759, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1830983', 'n_tokens_mistral': 1148, 'n_tokens_neox': 1121, 'n_words': 266}