Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add windows_safe_cd_system function #172

Closed
wants to merge 1 commit into from

3 participants

@zolrath

Windows users require modifications to the cd command whenever it is run,
this modified version of system simplifies that process.

I don't actually have access to a Windows machine at the moment, but from what I can tell my previous commit didn't reformat cd when called on Windows machines and thus shouldn't work properly.

Can someone test this to confirm that it fixes Windows related issues?

@zolrath zolrath Add windows_safe_cd_system for Windows
Windows users require modifications to the cd command whenever it is run,
this modified version of system simplifies that process.
595c3ab
@zolrath

I have some other ideas/questions about this before you consider pulling it, hopefully I can find you on IRC tomorrow to talk.

@robi-wan

Any progress on this?
I would like to see this issue fixed.

@gmarik
Owner

fixed in #243

@gmarik gmarik closed this
@trotha01 trotha01 referenced this pull request from a commit
@robi-wan robi-wan escape shell commands for windows
inspired by
#228 and
#172

Vim patch #445 changed shell escaping and introduced incompatabilities for vundle.
Now vundle only escapes joined commands with double quotes on windows when shellxquote is not set to '('.
This workaround closes #146 - the mentioned workaround
is no longer needed, but it does not break a vim configurations which contains "set shellxquote=".

DRY shell escaping and modified (hopefully) all relevant places.
b5bef26
@guyhughes guyhughes referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 30, 2012
  1. @zolrath

    Add windows_safe_cd_system for Windows

    zolrath authored
    Windows users require modifications to the cd command whenever it is run,
    this modified version of system simplifies that process.
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 17 deletions.
  1. +12 −11 autoload/vundle/installer.vim
  2. +1 −6 autoload/vundle/scripts.vim
View
23 autoload/vundle/installer.vim
@@ -170,7 +170,7 @@ func! vundle#installer#delete(bang, dir_name) abort
let bundle = vundle#config#init_bundle(a:dir_name, {})
let cmd .= ' '.shellescape(bundle.path())
- let out = s:system(cmd)
+ let out = g:windows_safe_cd_system(cmd)
call s:log('')
call s:log('Bundle '.a:dir_name)
@@ -208,19 +208,14 @@ func! s:sync(bang, bundle) abort
if !(a:bang) | return 'todate' | endif
let cmd = 'cd '.shellescape(a:bundle.path()).' && git pull'
- if (has('win32') || has('win64'))
- let cmd = substitute(cmd, '^cd ','cd /d ','') " add /d switch to change drives
- let cmd = '"'.cmd.'"' " enclose in quotes
- endif
-
let get_current_sha = 'cd '.shellescape(a:bundle.path()).' && git rev-parse HEAD'
- let initial_sha = s:system(get_current_sha)[0:15]
+ let initial_sha = g:windows_safe_cd_system(get_current_sha)[0:15]
else
let cmd = 'git clone '.a:bundle.uri.' '.shellescape(a:bundle.path())
let initial_sha = ''
endif
- let out = s:system(cmd)
+ let out = g:windows_safe_cd_system(cmd)
call s:log('')
call s:log('Bundle '.a:bundle.name_spec)
call s:log('$ '.cmd)
@@ -234,7 +229,7 @@ func! s:sync(bang, bundle) abort
return 'new'
endif
- let updated_sha = s:system(get_current_sha)[0:15]
+ let updated_sha = g:windows_safe_cd_system(get_current_sha)[0:15]
if initial_sha == updated_sha
return 'todate'
@@ -244,8 +239,14 @@ func! s:sync(bang, bundle) abort
return 'updated'
endf
-func! s:system(cmd) abort
- return system(a:cmd)
+func! g:windows_safe_cd_system(cmd) abort
+ if (has('win32') || has('win64'))
+ let cmd = substitute(a:cmd, '^cd ','cd /d ','') " add /d switch to change drives
+ let cmd = '"'.cmd.'"' " enclose in quotes
+ return system(cmd)
+ else
+ return system(a:cmd)
+ endif
endf
func! s:log(str) abort
View
7 autoload/vundle/scripts.vim
@@ -43,12 +43,7 @@ func! s:create_changelog() abort
\ ' && git log --pretty=format:"%s %an, %ar" --graph '.
\ initial_sha.'..'.updated_sha
- if (has('win32') || has('win64'))
- let cmd = substitute(cmd, '^cd ','cd /d ','') " add /d switch to change drives
- let cmd = '"'.cmd.'"' " enclose in quotes
- endif
-
- let updates = system(cmd)
+ let updates = g:windows_safe_cd_system(cmd)
call add(g:vundle_changelog, '')
call add(g:vundle_changelog, 'Updated Bundle: '.bundle.name)
Something went wrong with that request. Please try again.