Skip to content

Commit d6f494c

Browse files
committed
fix runtime.Goexit()
1 parent 3c64bd6 commit d6f494c

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

compiler/prelude/goroutines.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ var $go = function(fun, args, direct) {
129129
}
130130
$goroutine.exit = true;
131131
} catch (err) {
132+
if ($goroutine.exit) {
133+
return;
134+
}
132135
$goroutine.exit = true;
133136
throw err;
134137
} finally {

tests/misc_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,3 +496,9 @@ func TestBoolConvert(t *testing.T) {
496496
t.Fail()
497497
}
498498
}
499+
500+
func TestGoexit(t *testing.T) {
501+
go func() {
502+
runtime.Goexit()
503+
}()
504+
}

0 commit comments

Comments
 (0)