WolfgangMehner / vim-plugins

Vim plug-ins which offer support for various programming languages.
415 stars 96 forks source link

Perl-Support: "Run Script" returns "can't open script" - Issue with quotation marks? #23

Open oli666 opened 9 years ago

oli666 commented 9 years ago

Good morning Wolfgang,

a quick question for you ...

When running a script located in "'I:/texte/_source_code/Perl/playground.p" from within VIM I get the following error message (Windows 7, gvim 7.4 patch 1-712)

C:\Windows\system32\cmd.exe /c (C:\Perl\bin\perl.EXE 'I:/texte/_source_code/Perl /playground.pl') ConEmuC build 141208 x64. (c) 2009-2014, ConEmu.Maximus5@gmail.com Starting attach autorun (NewWnd=NO) Can't open perl script "'I:/texte/_source_code/Perl/playground.pl'": Invalid argument shell returned 22

Running the script from the command line works perfectly fine; the same is true for running it in Eclipse/EPIC.

I was just wondering if it had anything to do with the single and double quotation marks (" ' ... ' ") in :

Can't open perl script "'I:/texte/_source_code/Perl/playground.pl'"

Using the following on the Windows command line would envoke the same issue:

perl -w 'I:/texte/_source_code/Perl/playground.pl'

while the following alternatives on Windows work fine:

perl -w I:/texte/_source_code/Perl/playground.pl perl -w "I:/texte/_source_code/Perl/playground.pl"

It is worth noting that using cygwin on Windows alows for all 3 alternatives (no quotes, single OR double quotes).

I guess my question would be how I could change the single quote to a double quote when passing a script-name from VIM to the command.

Many thanks in advance,

Oli

WolfgangMehner commented 9 years ago

I do not understand where the single quotes come from, but they seem to cause the problem. Could you open the file in Vim and then run

:echo expand ("%:p")

on the Vim command line. What is the output? After that we can investigate further.

oli666 commented 9 years ago

The output is :

I:/texte/_source_code/Perl/playground.pl

From: Wolfgang Mehner [mailto:notifications@github.com] Sent: Sonntag, 3. Mai 2015 12:27 To: WolfgangMehner/vim-plugins Cc: oli666 Subject: Re: [vim-plugins] "Run Script" returns "can't open script" - issue with quotation marks? (#23)

I do not understand where the single quotes come from, but they seem to cause the problem. Could you open the file in Vim and then run

:echo expand ("%:p")

on the Vim command line. What is the output? After that we can investigate further.

— Reply to this email directly or view it on GitHub https://github.com/WolfgangMehner/vim-plugins/issues/23#issuecomment-98465340 .

WolfgangMehner commented 9 years ago

Ok, let's continue. What is the output of the following commands:

:echo shellescape(expand("%:p"))
:set shell?
:set shellslash?

These settings could have an influence.

oli666 commented 9 years ago

Output :

'I:/texte/_source_code/Perl/playground.pl'

From: Wolfgang Mehner [mailto:notifications@github.com] Sent: Montag, 4. Mai 2015 12:25 To: WolfgangMehner/vim-plugins Cc: oli666 Subject: Re: [vim-plugins] "Run Script" returns "can't open script" - issue with quotation marks? (#23)

:echo shellescape(expand ("%:p"))

— Reply to this email directly or view it on GitHub https://github.com/WolfgangMehner/vim-plugins/issues/23#issuecomment-98671077 .

oli666 commented 9 years ago

The commands trigger the following outputs:

:echo shellescape(expand("%:p")) 'I:/texte/_source_code/Perl/playground.pl' :set shell? shell=C:\Windows\system32\cmd.exe :set shellslash? shellslash

WolfgangMehner commented 9 years ago

If you disable shellshlash before running Perl, does it work then:

:set noshellslash

Then run Perl. Then reset shellslash

:set shellslash
oli666 commented 9 years ago

Indeed, that solved the issue! I will disable shellslash for now an will see, if that has any potential side effects for other plugins etc.

Many thanks for your quick support!

Oli

From: Wolfgang Mehner [mailto:notifications@github.com] Sent: Montag, 4. Mai 2015 13:22 To: WolfgangMehner/vim-plugins Cc: oli666 Subject: Re: [vim-plugins] "Run Script" returns "can't open script" - issue with quotation marks? (#23)

If you disable shellshlash before running Perl, does it work then:

:set noshellslash

Then run Perl. Then reset shellslash

:set shellslash

— Reply to this email directly or view it on GitHub https://github.com/WolfgangMehner/vim-plugins/issues/23#issuecomment-98680832 .

WolfgangMehner commented 9 years ago

Nice. I will automate this. To set shellslash before running scripts and reset it afterwards.

oli666 commented 9 years ago

Excellent! Thanks again for your support!

Oli

From: Wolfgang Mehner [mailto:notifications@github.com] Sent: Montag, 4. Mai 2015 13:49 To: WolfgangMehner/vim-plugins Cc: oli666 Subject: Re: [vim-plugins] "Run Script" returns "can't open script" - issue with quotation marks? (#23)

Nice. I will automate this. To set shellslash before running scripts and reset it afterwards.

— Reply to this email directly or view it on GitHub https://github.com/WolfgangMehner/vim-plugins/issues/23#issuecomment-98685816 .

WolfgangMehner commented 8 years ago

As far as I understand, 'shell' and 'shellslash' depend on each other and need to be set accordingly. See the documentation of the two options. So this will probably not result in changes to the Perl-Support.