Skip to content

"At code:1" error message #6

Description

@kooksee
  1. platform: mac
  2. code
func TestName(t *testing.T) {
	const code = `
var name = "test_hello";

function main() {
}

main();
`
	runtime := quickjs.NewRuntime()

	context := runtime.NewContext()
	defer context.Free()

	for {
		val, err := context.Eval(code)
		if err != nil {
			fmt.Printf("%#v\n", err)
			time.Sleep(time.Second)
			continue
		}

		g:=context.Globals()
		fmt.Println(g.Get("name"),val)
		time.Sleep(time.Millisecond*10)
		val.Free()
	}
}
  1. output
test_hello undefined
test_hello undefined
test_hello undefined
test_hello undefined
test_hello undefined
test_hello undefined
test_hello undefined
test_hello undefined
test_hello undefined
test_hello undefined
test_hello undefined
&quickjs.Error{Cause:"", Stack:"    at code:1\n"}
&quickjs.Error{Cause:"", Stack:"    at code:1\n"}
&quickjs.Error{Cause:"", Stack:"    at code:1\n"}
&quickjs.Error{Cause:"", Stack:"    at code:1\n"}
&quickjs.Error{Cause:"", Stack:"    at code:1\n"}
&quickjs.Error{Cause:"", Stack:"    at code:1\n"}
&quickjs.Error{Cause:"", Stack:"    at code:1\n"}
&quickjs.Error{Cause:"", Stack:"    at code:1\n"}
&quickjs.Error{Cause:"", Stack:"    at code:1\n"}
&quickjs.Error{Cause:"", Stack:"    at code:1\n"}
&quickjs.Error{Cause:"", Stack:"    at code:1\n"}
&quickjs.Error{Cause:"", Stack:"    at code:1\n"}
&quickjs.Error{Cause:"", Stack:"    at code:1\n"}
&quickjs.Error{Cause:"", Stack:"    at code:1\n"}
&quickjs.Error{Cause:"", Stack:"    at code:1\n"}
&quickjs.Error{Cause:"", Stack:"    at code:1\n"}
&quickjs.Error{Cause:"", Stack:"    at code:1\n"}
&quickjs.Error{Cause:"", Stack:"    at code:1\n"}
&quickjs.Error{Cause:"", Stack:"    at code:1\n"}
&quickjs.Error{Cause:"", Stack:"    at code:1\n"}
&quickjs.Error{Cause:"", Stack:"    at code:1\n"}
&quickjs.Error{Cause:"", Stack:"    at code:1\n"}
test_hello undefined

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions