fn check_mounts<I, S>(docker_cmd: &Path, volumes: I) -> Result<()>
    where I: IntoIterator<Item = S>,
          S: AsRef<OsStr>
{
    let mut cmd_args: Vec<OsString> = vec!["run".into(), "--rm".into()];
    let image = image_identifier_for_active_target(&docker_cmd);

    for vol in volumes {
        cmd_args.push("--volume".into());
        cmd_args.push(vol.as_ref().into());
    }
    cmd_args.push(image.into());
    cmd_args.push("-V".into());
    let version_output = Command::new(docker_cmd).args(&cmd_args)
                                                 .output()
                                                 .expect("docker failed to start");

    let stderr = String::from_utf8(version_output.stderr).unwrap();
    if !stderr.is_empty()
       && (stderr.as_str().contains("Mounts denied")
           || stderr.as_str().contains("drive is not shared"))
    {
        return Err(Error::DockerFileSharingNotEnabled);
    }
    Ok(())
}
/// Checks whether or not the volume mounts are working.
///
/// We need to ensure that filesystem sharing has been enabled, otherwise the user will be
/// greeted with a horrible error message that's difficult to make sense of. To mitigate this,
/// we check the studio version. This will cause Docker to go through the mounting steps, so we
/// can watch stderr for failure, but has the advantage of not requiring a TTY.
Checks whether or not the volume mounts are working.
We need to ensure that filesystem sharing has been enabled, otherwise the user will be
greeted with a horrible error message that's difficult to make sense of. To mitigate this,
we check the studio version. This will cause Docker to go through the mounting steps, so we
can watch stderr for failure, but has the advantage of not requiring a TTY.
Checks whether or not the volume mounts are working . We need to ensure that filesystem sharing has been enabled otherwise the user will be greeted with a horrible error message that ' s difficult to make sense of . To mitigate this we check the studio version . This will cause Docker to go through the mounting steps so we can watch stderr for failure but has the advantage of not requiring a TTY .
fn check_mounts<I, S>(docker_cmd: &Path, volumes: I) -> Result<()>
    where I: IntoIterator<Item = S>,
          S: AsRef<OsStr>
{
    let mut cmd_args: Vec<OsString> = vec!["run".into(), "--rm".into()];
    let image = image_identifier_for_active_target(&docker_cmd);
    for vol in volumes {
        cmd_args.push("--volume".into());
        cmd_args.push(vol.as_ref().into());
    }
    cmd_args.push(image.into());
    cmd_args.push("-V".into());
    let version_output = Command::new(docker_cmd).args(&cmd_args)
                                                 .output()
                                                 .expect("docker failed to start");
    let stderr = String::from_utf8(version_output.stderr).unwrap();
    if !stderr.is_empty()
       && (stderr.as_str().contains("Mounts denied")
           || stderr.as_str().contains("drive is not shared"))
    {
        return Err(Error::DockerFileSharingNotEnabled);
    }
    Ok(())
}
fn check_mounts < I , S > ( docker_cmd : & Path , volumes : I ) -> Result < ( ) > where I : IntoIterator < Item = S > , S : AsRef < OsStr > { let mut cmd_args : Vec < OsString > = vec ! [ " " into ( ) " " into ( ) ] ; let image = image_identifier_for_active_target ( & docker_cmd ) ; for vol in volumes { cmd_args . push ( " " . into ( ) ) ; cmd_args . push ( vol . as_ref ( ) . into ( ) ) ; } cmd_args . push ( image . into ( ) ) ; cmd_args . push ( " " . into ( ) ) ; let version_output = Command :: new ( docker_cmd ) . args ( & cmd_args ) . output ( ) . expect ( " " ) ; let stderr = String :: from_utf8 ( version_output . stderr ) . unwrap ( ) ; if ! stderr . is_empty ( ) && ( stderr . as_str ( ) . contains ( " " ) || stderr . as_str ( ) . contains ( " " ) ) { return Err ( Error :: DockerFileSharingNotEnabled ) ; } Ok ( ( ) ) }
Checks whether or not the volume mounts are working.
Checks whether or not the volume mounts are working .
docker_cmd
&Path
volumes
I
docker_cmd
&Path
volumes
I