Skip to content

Commit 1da8de9

Browse files
committed
fix(sdk): stderr on crash now shown in test page
1 parent c9277b3 commit 1da8de9

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

playground/misc/misc-3-release-notes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ The CodinGame SDK is regularly updated and improved. This document lets you know
1313

1414
- Changed CSS of statement preview to match the codingame IDE
1515
- Fixed bug where newline in Text entities would crash the game
16+
- Fixed missing display of the agent's standard error stream on crash
1617

1718
## 3.10.1
1819

runner/src/main/resources/view/app.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,21 @@ function PlayerCtrl ($scope, $timeout, $interval, $element) {
171171
}
172172
}
173173
for (const pi in data.ids) {
174-
frames[i].stderr = frames[i].stderr || data.errors[pi][i]
175-
frames[i].stdout = frames[i].stdout || data.outputs[pi][i]
176-
for (const agentId in data.outputs) {
177-
const output = data.outputs[agentId]
178-
// check that at turn i, agent has output not null, so it is agent's turn
179-
if (output[i] != null && agentId !== 'referee') {
180-
frames[i].agentId = agentId
181-
break
174+
const stdout = data.outputs[pi][i]
175+
const stderr = data.errors[pi][i]
176+
177+
if (pi !== 'referee') {
178+
// If this agent has output, it is the frame's only active agent
179+
if (stdout || stderr) {
180+
frames[i].agentId = pi
181+
}
182+
if (data.errors[pi][i]) {
183+
// This frame's active agent has output this on stderr
184+
frames[i].stderr = stderr
185+
}
186+
if (data.outputs[pi][i]) {
187+
// This frame's active agent has output this on stdout
188+
frames[i].stdout = stdout
182189
}
183190
}
184191
}

0 commit comments

Comments
 (0)