From a84f6ee550e983725eecb9a7f6b31e182d4fd014 Mon Sep 17 00:00:00 2001 From: Valentin Deleplace Date: Wed, 22 Mar 2023 14:46:32 +0100 Subject: [PATCH] tour: call 'done' callback after Run, on message Kind 'system' To restore the button Run and hide the button Kill (in A Tour of Go, not in the main Playground), writeInterceptor is expecting a call of Kind 'end'. However, on compilation error the last call emitted has Kind 'system'. Fixes golang/go#50921 Change-Id: I698331e477e79fef368550d5976b5b2fc0b03e83 Reviewed-on: https://go-review.googlesource.com/c/website/+/478415 Reviewed-by: Dmitri Shuralyov LUCI-TryBot-Result: Go LUCI Reviewed-by: Eno Compton Auto-Submit: Carlos Amedee Reviewed-by: Dmitri Shuralyov --- _content/js/playground.js | 5 +++-- _content/tour/static/js/services.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/_content/js/playground.js b/_content/js/playground.js index b23054c96e..5289f06c29 100644 --- a/_content/js/playground.js +++ b/_content/js/playground.js @@ -24,7 +24,7 @@ here's a skeleton implementation of a playground transport. // The output callback is called multiple times, and each time it is // passed an object of this form. var write = { - Kind: 'string', // 'start', 'stdout', 'stderr', 'end' + Kind: 'string', // 'start', 'stdout', 'stderr', 'end', 'system' Body: 'string' // content of write or end status message } @@ -32,7 +32,8 @@ here's a skeleton implementation of a playground transport. // Subsequent calls may be of Kind 'stdout' or 'stderr' // and must have a non-null Body string. // The final call should be of Kind 'end' with an optional - // Body string, signifying a failure ("killed", for example). + // Body string, signifying a failure ("killed", for example), + // or be of Kind 'system'. // The output callback must be of this form. // See PlaygroundOutput (below) for an implementation. diff --git a/_content/tour/static/js/services.js b/_content/tour/static/js/services.js index e5be014a28..42971af50a 100755 --- a/_content/tour/static/js/services.js +++ b/_content/tour/static/js/services.js @@ -45,7 +45,7 @@ factory('run', ['$window', 'editor', } } writer(write); - if (write.Kind == 'end') done(); + if (write.Kind == 'end' || write.Kind == 'system') done(); }; }; return function(code, output, options, done) {