• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

pkgxdev / pkgx / 13399397190

18 Feb 2025 08:21PM UTC coverage: 89.015% (-0.9%) from 89.952%
13399397190

push

github

mxcl
pantry.tgz url should base on `$PKGX_DIST_URL`

6 of 6 new or added lines in 1 file covered. (100.0%)

16 existing lines in 4 files now uncovered.

1329 of 1493 relevant lines covered (89.02%)

1116.91 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/crates/cli/src/execve.rs
1
use nix::unistd::execve as nix_execve;
2
use std::ffi::CString;
3
use std::{collections::HashMap, error::Error};
4

5
pub fn execve(
×
6
    cmd: String,
7
    mut args: Vec<String>,
8
    env: HashMap<String, String>,
9
) -> Result<(), Box<dyn Error>> {
10
    // Convert the command to a CString
11
    let c_command = CString::new(cmd.clone())
×
12
        .map_err(|e| format!("Failed to convert command to CString: {}", e))?;
×
13

14
    // execve expects the command to be the first argument (yes, as well)
UNCOV
15
    args.insert(0, cmd);
×
16

17
    // Convert the arguments to CStrings and collect them into a Vec
18
    let c_args: Vec<CString> = args
×
19
        .iter()
20
        .map(|arg| {
×
21
            CString::new(arg.clone())
×
22
                .map_err(|e| format!("Failed to convert argument to CString: {}", e))
×
23
        })
24
        .collect::<Result<_, _>>()?;
25

26
    // Convert the environment to a Vec of `KEY=VALUE` strings
UNCOV
27
    let env_vars: Vec<String> = env
×
28
        .iter()
29
        .map(|(key, value)| format!("{}={}", key, value))
×
30
        .collect();
31

32
    // Convert the environment variables to CStrings and collect them into a Vec
33
    let c_env: Vec<CString> = env_vars
×
34
        .iter()
35
        .map(|env| {
×
36
            CString::new(env.clone())
×
37
                .map_err(|e| format!("Failed to convert environment variable to CString: {}", e))
×
38
        })
39
        .collect::<Result<_, _>>()?;
40

41
    // Replace the process with the new command, arguments, and environment
UNCOV
42
    let execve_result = nix_execve(&c_command, &c_args, &c_env);
×
UNCOV
43
    if execve_result.is_err() {
×
44
        let errno = execve_result.unwrap_err();
×
45
        return Err(format!("execve failed with errno: {}", errno).into());
×
46
    }
47

48
    Ok(())
×
49
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc