Starting subprocess is working now

This commit is contained in:
Chiel92 2013-07-07 13:06:07 +02:00
parent e453c2b772
commit 2743f96529

View File

@ -80,20 +80,24 @@ class CsharpCompleter( ThreadedCompleter ):
if len( solutionfiles ) == 0:
vimsupport.PostVimMessage( 'Error starting OmniSharp server: no solutionfile found' )
return
elif len( solutionfiles ) == 1:
solutionfile = solutionfiles[0]
else:
# This still has to be caught by giving the user a choice
vimsupport.PostVimMessage( 'Error starting OmniSharp server: multiple solutionfiles found' )
return
omnisharp = os.path.join( os.path.abspath( os.path.dirname( __file__ ) ),
'OmniSharpServer/OmniSharp/bin/Debug/OmniSharp.exe' )
solutionfile = os.path.join ( folder, solutionfiles[0] )
command = [ omnisharp, '-p ' + str( self.OmniSharpPort ), '-s ' + solutionfile ]
solutionfile = os.path.join ( folder, solutionfile )
# command has to be provided as one string
command = [ omnisharp + ' -p ' + str( self.OmniSharpPort ) + ' -s ' + solutionfile ]
vimsupport.PostVimMessage( 'starting server... ' + ' '.join( command ) )
vimsupport.PostVimMessage( 'starting server...\n' + ' '.join( command ) )
# Why doesn't this work properly?
# When starting manually in seperate console, everything works
# Maybe due to bothering stdin/stdout redirecting?
subprocess.Popen( command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE )
else:
vimsupport.PostVimMessage( 'Error starting OmniSharp server: multiple solutionfiles found' )
with open(os.devnull, "w") as fnull:
result = subprocess.Popen(command, stdout = fnull, stderr = fnull, shell=True)
def _StopServer( self ):
""" Stop the OmniSharp server """