From c6b50a5fed0441ac0765ad38b4f6fb0f1b38f92c Mon Sep 17 00:00:00 2001 From: Roey Darwish Dror Date: Tue, 21 May 2019 16:39:13 +0300 Subject: [PATCH] Check that vim is actually vim (fix #152) --- src/steps/vim.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/steps/vim.rs b/src/steps/vim.rs index bdec8a41..4790e94d 100644 --- a/src/steps/vim.rs +++ b/src/steps/vim.rs @@ -1,5 +1,5 @@ use crate::error::{Error, ErrorKind}; -use crate::executor::{ExecutorOutput, RunType}; +use crate::executor::{CommandExt, ExecutorOutput, RunType}; use crate::terminal::print_separator; use crate::utils::{require, require_option, PathExt}; use directories::BaseDirs; @@ -7,6 +7,7 @@ use std::path::PathBuf; use std::{ fs, io::{self, Write}, + process::Command, }; #[derive(Debug, Clone, Copy)] @@ -94,6 +95,12 @@ fn upgrade(vim: &PathBuf, vimrc: &PathBuf, plugin_framework: PluginFramework, ru #[must_use] pub fn upgrade_vim(base_dirs: &BaseDirs, run_type: RunType) -> Result<(), Error> { let vim = require("vim")?; + + let output = Command::new(&vim).arg("--version").check_output()?; + if !output.starts_with("VIM") { + Err(ErrorKind::SkipStep)?; + } + let vimrc = require_option(vimrc(&base_dirs))?; let plugin_framework = require_option(PluginFramework::detect(&vimrc))?;