Skip to content

Commit

Permalink
tour: call 'done' callback after Run, on message Kind 'system'
Browse files Browse the repository at this point in the history
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 <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Eno Compton <[email protected]>
Auto-Submit: Carlos Amedee <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
  • Loading branch information
Deleplace authored and gopherbot committed Jan 19, 2024
1 parent f6415c7 commit a84f6ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions _content/js/playground.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ 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
}
// The first call must be of Kind 'start' with no body.
// 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.
Expand Down
2 changes: 1 addition & 1 deletion _content/tour/static/js/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a84f6ee

Please sign in to comment.