Shell interpolation does not work on Windows

Bug #1266433 reported by esquifit on 2014-01-06
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

Shell interpolation does not work on Windows. Example

snippet dir "Insert contents of current directory"

On expanding this, the output of the 'dir' command is not inserted. Interpolation for VimL and Python is working fine though.

The problem seems to be

File: plugin/Ultisnips/text_objects/,
Line: 26
        proc = subprocess.Popen(path, shell=True, stdout=subprocess.PIPE)

In effect, this does not return anything (Note that the temporary file is correctly created and the interpolated code is written into it).

For this to work it is necessary to make the file executable. Line 23
        os.chmod(path, stat.S_IRWXU)
has apparently no effect in Windows. Instead, the temporary file needs to be registered to an executable type by means of an appropriate extension. Changing line 19:
        handle, path = tempfile.mkstemp(text=True)
        handle, path = tempfile.mkstemp(text=True, suffix='.bat')
solves the problem in a cross-platform way, since the .bat extension has no relevance outside Windows.

Not sure if this is the most elegant/correct way.

SirVer (sirver) wrote :

Which version are you using? the current code already uses .bat for windows:

Changed in ultisnips:
status: New → Incomplete
esquifit (esquifit+lp) wrote :

Hm, I see. I (naively?) checked the version in the ChangeLog file, according to which my version 2.2 would be the latest. I need to retrieve the latest one. This can be closed. Sorry for the noise and thanks for the quick answer.

SirVer (sirver) wrote :

> naively

absolutely not, you were not at fault at all. I just did not release in a long time - most users track directly from github using something like vundle and therelike, so there is little pressure on me.

Changed in ultisnips:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers