Fixed OmniSharp launch under Windows (again)

We pass shell=True to Popen so that OmniSharp is not started inside a
new visible window under Windows. And since we use shell=True, we pass
the command to execute as a string, as recommended by Python's docs
(also, it won't work when passed as a sequence anyway :) ).
This commit is contained in:
nop 2013-12-10 12:46:05 +01:00
parent ee90d9b09b
commit fd6338fa88

View File

@ -151,11 +151,13 @@ class CsharpCompleter( Completer ):
raise RuntimeError( SERVER_NOT_FOUND_MSG.format( omnisharp ) )
path_to_solutionfile = os.path.join( folder, solutionfile )
command = [ omnisharp, '-p', str( self._omnisharp_port ), '-s',
path_to_solutionfile ]
# we need to pass the command to Popen as a string since we're passing
# shell=True (as recommended by Python's doc)
command = omnisharp + ' -p ' + str( self._omnisharp_port ) + ' -s ' + \
path_to_solutionfile
if not utils.OnWindows():
command.insert(0, 'mono')
command = 'mono ' + command
filename_format = os.path.join( utils.PathToTempDir(),
'omnisharp_{port}_{sln}_{std}.log' )
@ -167,7 +169,9 @@ class CsharpCompleter( Completer ):
with open( self._filename_stderr, 'w' ) as fstderr:
with open( self._filename_stdout, 'w' ) as fstdout:
subprocess.Popen( command, stdout=fstdout, stderr=fstderr )
# shell=True is needed for Windows so OmniSharp does not spawn
# in a new visible window
subprocess.Popen( command, stdout=fstdout, stderr=fstderr, shell=True )
self._logger.info( 'Starting OmniSharp server' )