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 handle escaping #235

Closed
wenchangshou2 opened this issue Apr 9, 2019 · 1 comment
Closed

How to handle escaping #235

wenchangshou2 opened this issue Apr 9, 2019 · 1 comment

Comments

@wenchangshou2
Copy link

wenchangshou2 commented Apr 9, 2019

I want to call os.execute to disable the service, and the service name has a space, so I can't execute it correctly.

func Test_lua(t *testing.T) {

	L := lua.NewState()
	defer L.Close()
	if err := L.DoString(`
	os.execute("net stop zoolon-Daemon")
	os.execute("net stop \"Zoolon Daemon Service\"")
	os.execute("sc config \\"Zoolon Daemon Service\\" start= disabled")
		`); err != nil {
		t.Error()
		panic(err)
	}
}
@yuin
Copy link
Owner

yuin commented May 13, 2019

GopherLua uses os.StartProcess to create child process. You seems running into this issue( golang/go#15566). https://github.com/otm/gluash might be helpful for you.

@yuin yuin closed this as completed Apr 30, 2022
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

2 participants