Skip to content

Commit 2eff40d

Browse files
Child process termination alert, references #93
1 parent b6d0397 commit 2eff40d

File tree

5 files changed

+22
-6
lines changed

5 files changed

+22
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"printableName": "Cache Web Terminal",
66
"description": "Web-based terminal emulator for Caché administering.",
77
"author": "ZitRo",
8-
"version": "4.2.6",
8+
"version": "4.2.7",
99
"gaID": "UA-83005064-2",
1010
"releaseNumber": 26,
1111
"scripts": {

src/client/js/localization/dictionary.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,5 +356,9 @@ export default {
356356
"unNS": {
357357
en: "Unable to change namespace to %s.",
358358
ru: "Не получается поменять область на %s."
359+
},
360+
"cpTerm": {
361+
en: "Terminal process was terminated.",
362+
ru: "Процесс терминала был завершён."
359363
}
360364
};

src/cls/WebTerminal/Common.cls

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,23 @@ ClassMethod ReceiveChunk(timeout As %Numeric = -1) As %String
3333
{
3434
set flag = ""
3535
set str = ""
36+
set status = -1
3637
for {
3738
set message = $system.Event.WaitMsg("", $Case(timeout = -1, 1: 1, :timeout))
39+
set status = $LISTGET(message, 1)
3840
set data = $LISTGET(message, 2)
41+
if (status <= 0) {
42+
if ($ZPARENT '= 0) && ('$data(^$Job($ZPARENT))) {
43+
do $system.Process.Terminate($JOB, 0)
44+
return $LISTBUILD(flag, str, -1)
45+
}
46+
if ($ZCHILD '= 0) && ('$data(^$Job($ZCHILD))) {
47+
return $LISTBUILD(flag, str, -1)
48+
}
49+
}
3950
if (data = "") && (timeout = 0) quit
40-
set status = $LISTGET(message, 1)
4151
if (status <= 0) {
42-
do:'$data(^$Job($ZPARENT)) $system.Process.Terminate($JOB, 0)
43-
if (timeout = 0) set timeout = 1
52+
set:(timeout = 0) timeout = 1
4453
continue
4554
}
4655
set flag = $LISTGET(data, 1)
@@ -49,7 +58,7 @@ ClassMethod ReceiveChunk(timeout As %Numeric = -1) As %String
4958
if (timeout = 0) set timeout = 1
5059
quit:($LENGTH(m) '= ..#ChunkSize)
5160
}
52-
return $LISTBUILD(flag, str)
61+
return $LISTBUILD(flag, str, status)
5362
}
5463

5564
/// Returns the contents of the proxy object to the current device in JSON format.<br/>

src/cls/WebTerminal/Engine.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ Method ClientLoop() As %Status [ Private ]
189189
set ..echo = 1
190190
if (status '= "") && (status '= $$$OK) {
191191
set eType = $EXTRACT(status, 1, 1)
192-
do ..Send("execError", $case(eType = 0, 1: $System.Status.GetErrorText(status), :status))
192+
do ..Send("oLocalized", $C(13,10) _ $case(eType = 0, 1: $System.Status.GetErrorText(status), :status))
193193
continue
194194
}
195195
}

src/cls/WebTerminal/Handlers.cls

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ ClassMethod Execute (client As WebTerminal.Engine, data, bareStart As %Boolean =
2727
loop
2828
for {
2929
set message = client.ReceiveChunk(0) // we need to read from WebSocket as well: timeout = 0
30+
if ($LISTGET(message, 3) < 0) {
31+
return $$$ERROR($$$GeneralError, "%cpTerm")
32+
}
3033
set flag = $LISTGET(message, 1)
3134
if (flag = "") { // if there is no messages from the child process executing the task,
3235
set mes = client.GetMessage(0) // look at the incoming WebSocket messages

0 commit comments

Comments
 (0)