diff options
Diffstat (limited to 'main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/InteractiveSession.fs')
-rw-r--r-- | main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/InteractiveSession.fs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/InteractiveSession.fs b/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/InteractiveSession.fs index f461f22c5d..0736a082e7 100644 --- a/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/InteractiveSession.fs +++ b/main/external/fsharpbinding/MonoDevelop.FSharpBinding/Services/InteractiveSession.fs @@ -18,7 +18,7 @@ type CompletionData = { description: string } -type InteractiveSession() = +type InteractiveSession(pathToExe) = let (|Completion|_|) (command: string) = if command.StartsWith("completion ") then let payload = command.[11..] @@ -40,15 +40,14 @@ type InteractiveSession() = else None - let path = "\"" + Path.Combine(Reflection.Assembly.GetExecutingAssembly().Location |> Path.GetDirectoryName, "MonoDevelop.FSharpInteractive.Service.exe") + "\"" let mutable waitingForResponse = false let fsiProcess = let processName = - if Environment.runningOnMono then Environment.getMonoPath() else path + if Environment.runningOnMono then Environment.getMonoPath() else pathToExe let arguments = - if Environment.runningOnMono then path else null + if Environment.runningOnMono then pathToExe else null let startInfo = new ProcessStartInfo @@ -98,7 +97,7 @@ type InteractiveSession() = | ParameterHints hints -> parameterHintReceivedEvent.Trigger hints | _ -> LoggingService.logDebug "[fsharpi] don't know how to process command %s" de.Data - + with | :? JsonException -> LoggingService.logError "[fsharpi] - error deserializing error stream - %s" de.Data @@ -120,6 +119,8 @@ type InteractiveSession() = member x.TextReceived = textReceived.Publish member x.PromptReady = promptReady.Publish + member x.HasExited() = fsiProcess.HasExited + member x.Kill() = if not fsiProcess.HasExited then x.SendInput "#q;;" @@ -135,6 +136,8 @@ type InteractiveSession() = LoggingService.logDebug "Interactive: waiting for process exit after kill... %d" (i*200) fsiProcess.WaitForExit(200) |> ignore + member x.KillNow() = fsiProcess.Kill() + member x.SendInput input = for line in String.getLines input do sendCommand ("input " + line) |