intersystems-community / vscode-objectscript

InterSystems ObjectScript extension for Visual Studio Code
https://docs.intersystems.com/components/csp/docbook/DocBook.UI.Page.cls?KEY=GVSCO
Other
108 stars 49 forks source link

Websocket terminal output not shown until next input #1280

Closed EnricoParisi closed 11 months ago

EnricoParisi commented 11 months ago

Type: Bug

In Websocket terminal if you run some code that perform Read commands on other devices (i.e. not on terminal itself), then the output (any write to terminal) in not displayed until, after the execution of the code, enter is pressed.

To reproduce the problem, create use a (relatively) big txt file, around 5MB or more (it should take a little while to read it) and run this oneliner from Websocket terminal:

Set file="c:\temp\anytext.log" Open file:"R" Use file Try {For {Read Line}} Catch {Close file} Use 0 Write "Done",!

When it finishes nothing is displayed and you get the prompt. If you press enter at the prompt, then "Done" is written in the terminal.

The problem is server side in %Atelier.v7.TerminalAgent.cls, when check if the debug process is stil running or is reading from terminal in the line:

If (((tState = "EVTW") && (tStopped = 1)) || ($EXTRACT(tState,1,4) = "READ")) {

In addition to test if the process in in READ* state, it should check that the read is performed on the terminal (the debug device), so it should be:

If (((tState = "EVTW") && (tStopped = 1)) || (($EXTRACT(tState,1,4) = "READ") && ($SYSTEM.Process.CurrentDevice(..Debug.Pid) = ..Debug.Dev))) {

I’m using: IRIS for Windows (x86-64) 2023.3 (Build 254U) Wed Nov 8 2023 13:17:47 EST InterSystems Server Manager v3.4.2

Extension version: 3.4.2 VS Code version: Code 1.84.2 (1a5daa3a0231a0fbba4f14db7ec463cf99d7768e, 2023-11-09T10:51:52.184Z) OS version: Windows_NT x64 10.0.19045 Modes:

gjsjohnmurray commented 11 months ago

This feature is implemented by the ObjectScript extension, not Server Manager, so I have transferred the issue.

isc-bsaviano commented 11 months ago

@EnricoParisi Thanks for reporting this. Since the bug is in ISC code I will close this and fix it internally.