pub fn try_to_attach_hsm() {
        if let Ok(metadata) = std::fs::metadata(VSOCK_AGENT_PATH) {
            let permissions = metadata.permissions();
            if permissions.mode() & 0o111 != 0 {
                // Executable exists. We will run it, without checking the result.
                // The attach may fail or happen later, and that needs to be handled at a
                // higher level.
                // Once we finish migration to the Ubuntu-based IC-OS and the Vsock-based HSM
                // sharing, we'll want to know whether and why the command failed.
                if StdCommand::new(VSOCK_AGENT_PATH)
                    .arg("--attach-hsm".to_string())
                    .status()
                    .is_ok()
                {
                    std::thread::sleep(std::time::Duration::from_millis(300));
                }
            }
        }
    }
/// Try to attach the USB HSM, if the VSOCK_AGENT_PATH binary
/// exists. Ignore any errors in the execution.
Try to attach the USB HSM, if the VSOCK_AGENT_PATH binary
exists. Ignore any errors in the execution.
Try to attach the USB HSM if the VSOCK_AGENT_PATH binary exists . Ignore any errors in the execution .
pub fn try_to_attach_hsm() {
        if let Ok(metadata) = std::fs::metadata(VSOCK_AGENT_PATH) {
            let permissions = metadata.permissions();
            if permissions.mode() & 0o111 != 0 {
                // Executable exists. We will run it, without checking the result.
                // The attach may fail or happen later, and that needs to be handled at a
                // higher level.
                // Once we finish migration to the Ubuntu-based IC-OS and the Vsock-based HSM
                // sharing, we'll want to know whether and why the command failed.
                if StdCommand::new(VSOCK_AGENT_PATH)
                    .arg("--attach-hsm".to_string())
                    .status()
                    .is_ok()
                {
                    std::thread::sleep(std::time::Duration::from_millis(300));
                }
            }
        }
    }
pub fn try_to_attach_hsm ( ) { if let Ok ( metadata ) = std :: fs :: metadata ( VSOCK_AGENT_PATH ) { let permissions = metadata . permissions ( ) ; if permissions . mode ( ) & 0o111 != 0 { // Executable exists. We will run it, without checking the result. // The attach may fail or happen later, and that needs to be handled at a // higher level. // Once we finish migration to the Ubuntu-based IC-OS and the Vsock-based HSM // sharing, we'll want to know whether and why the command failed. if StdCommand :: new ( VSOCK_AGENT_PATH ) . arg ( " " . to_string ( ) ) . status ( ) . is_ok ( ) { std :: thread :: sleep ( std :: time :: Duration :: from_millis ( 300 ) ) ; } } } }
Try to attach the USB HSM, if the VSOCK_AGENT_PATH binary
exists.
Try to attach the USB HSM if the VSOCK_AGENT_PATH binary exists .