2013-10-06 2 views
2

다음 vim 함수를 사용하여 Windows에서 sas를 실행하려고하지만 시스템에 대한 인수가 유효하지 않습니다라는 오류 메시지가 항상 나타납니다.vim 함수 시스템의 잘못된 인수

일부 전문가는 나를 도울 수 있습니까?

C :

MYY의 SAS가 설치되어 \ 프로그램 파일 \ SAS \ ​​SAS \ ​​9.1 \ sas.exe

function! RunSASonCurrentFile() 
    " Make sure this is a SAS program file (ends with .sas) so that 
    " we don't run SAS on a log file or similar. 
    :let checkSASpgm=match(expand("%"),"\.sas") 

    " If we did not match .sas in the file name, end this function with 
    " a warning msg 
    if checkSASpgm==-1 
     :echo "*** Current file is not a SAS program. SAS run has been canceled." 
     :return 
    endif 

    " Ask user if we want to run SAS so we don't accidentally run it. 
    :let l:answer = input("Run SAS? Y/N ") 
    :if (l:answer == "Y" || l:answer == "y") 

    " If file has been modified, save it before running 
    if exists(&modified) 
     :echo "*** Saving modified file before SAS run..." 
     :w 
    endif 

    " Run SAS on path/file name (modify to your location of sas) 
    :echo "*** Running SAS..." 
    "let returntxt = system("/usr/local/bin/sas -nodms " . shellescape(expand("%:p"))) 
    " The following may work for your Windows system. Comment the line above and uncomment 
    " the two lines below and make them one long line. 
    let returntxt = system("\"" . shellescape("C:\\Program\ Files\\SAS\\SAS\9.1\\sas.exe") 
    ". "\ -nosplash" . "\ -sysin" . "\ " . shellescape(expand("%:p")) . "\"") 

    " Shows the return messages from the SAS commandline (may be useful 
    " if no log produced) 
    :echo "*** SAS commandline: " . returntxt 

    :call LoadSASLogList() 

    :else 
    :echo "SAS Run cancelled." 

    " endif for the Run SAS? check 
    :endif 
    endfunction 

답변

4

빔 패치 7.3.443은 쉘 탈출의 행동 방식을 변경했습니다. (윈도우즈 쉘 탈출 규칙으로 인해 문제가 계속됩니다.) 반면에 공백이있는 실행 파일 (자체 인용)이 포함되어 있다면 미리 명령 줄을 큰 따옴표로 묶어야하지만, 이제는 제거해야합니다. 다음을 시도하십시오.

let returntxt = system(shellescape('C:\Program Files\SAS\SAS\9.1\sas.exe') . ' -nosplash -sysin ' . shellescape(expand('%:p'))) 

이렇게하면 작은 따옴표로 묶은 문자열을 사용하여 몇 가지 추가 이스케이프가 발생하지 않습니다.

0

그 함수의 정확한 텍스트가 있다면, 당신은 것 같아요 라인 let returntxt = system("\"" . shellescape("C:\\Program\ Files\\SAS\\SAS\9.1\\sas.exe")에서 SAS와 9.1 사이에 두 번째 \가 누락되었습니다.

+0

나는 그것을 바로 잡으려고했다. 작동하지 않습니다. 대답 해줘서 고마워. – john

+0

시스템 (....)에 잘못된 argagument가 표시됩니다. 나는 잘못된 문자열을 통과 할까 봐 걱정합니다. – john