Starting subprocess is working now
This commit is contained in:
parent
e453c2b772
commit
2743f96529
@ -80,20 +80,24 @@ class CsharpCompleter( ThreadedCompleter ):
|
|||||||
|
|
||||||
if len( solutionfiles ) == 0:
|
if len( solutionfiles ) == 0:
|
||||||
vimsupport.PostVimMessage( 'Error starting OmniSharp server: no solutionfile found' )
|
vimsupport.PostVimMessage( 'Error starting OmniSharp server: no solutionfile found' )
|
||||||
|
return
|
||||||
elif len( solutionfiles ) == 1:
|
elif len( solutionfiles ) == 1:
|
||||||
omnisharp = os.path.join( os.path.abspath( os.path.dirname( __file__ ) ),
|
solutionfile = solutionfiles[0]
|
||||||
'OmniSharpServer/OmniSharp/bin/Debug/OmniSharp.exe' )
|
|
||||||
solutionfile = os.path.join ( folder, solutionfiles[0] )
|
|
||||||
command = [ omnisharp, '-p ' + str( self.OmniSharpPort ), '-s ' + solutionfile ]
|
|
||||||
|
|
||||||
vimsupport.PostVimMessage( 'starting server... ' + ' '.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:
|
else:
|
||||||
|
# This still has to be caught by giving the user a choice
|
||||||
vimsupport.PostVimMessage( 'Error starting OmniSharp server: multiple solutionfiles found' )
|
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, solutionfile )
|
||||||
|
# command has to be provided as one string
|
||||||
|
command = [ omnisharp + ' -p ' + str( self.OmniSharpPort ) + ' -s ' + solutionfile ]
|
||||||
|
|
||||||
|
vimsupport.PostVimMessage( 'starting server...\n' + ' '.join( command ) )
|
||||||
|
|
||||||
|
with open(os.devnull, "w") as fnull:
|
||||||
|
result = subprocess.Popen(command, stdout = fnull, stderr = fnull, shell=True)
|
||||||
|
|
||||||
def _StopServer( self ):
|
def _StopServer( self ):
|
||||||
""" Stop the OmniSharp server """
|
""" Stop the OmniSharp server """
|
||||||
|
Loading…
Reference in New Issue
Block a user