Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to restart plugin after subprocess exited #305

Open
lzytaro opened this issue Mar 26, 2024 · 0 comments
Open

how to restart plugin after subprocess exited #305

lzytaro opened this issue Mar 26, 2024 · 0 comments

Comments

@lzytaro
Copy link

lzytaro commented Mar 26, 2024

helo, i'm studing go-plugin. i want to know how to restart plugin procee after killed plugin process or plugin process exit unexpected.

	// Request the plugin
	raw, err := rpcClient.Dispense("greeter")
	if err != nil {
		log.Fatal(err)
	}

	// We should have a Greeter now! This feels like a normal interface
	// implementation but is in fact over an RPC connection.
	greeter := raw.(shared.Greeter)
	fmt.Println(greeter.Greet())
	for {
        // killed plugin process while ranging
		if client.Exited() {
			log.Println("plugin exited")
			fmt.Println(client.Start())    // here print: 127.0.0.1:10001 <nil> ; but sub process doesn't started
		}
		time.Sleep(time.Second * 1)
	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant