Skip to content

os/exec: OpenSSL windows execute with space path not working in the golang #50820

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

Closed
raminfp opened this issue Jan 26, 2022 · 0 comments
Closed

Comments

@raminfp
Copy link

raminfp commented Jan 26, 2022

What version of Go are you using (go version)?

$ go version
go version go1.16.5 windows/amd64

Does this issue reproduce with the latest release?

        command := "openssl smime -decrypt -in \\\"E:\\\\My Projects\\\\Open Code\\\\test\\\\encrypt\\\\data.ravro\\\" -inform DER -inkey key/key.private -out \\\"E:\\\\My Projects\\\\Open Code\\\\decrypt\\\\data\\\" -binary"

	stdout := &bytes.Buffer{}
	stderr := &bytes.Buffer{}
	cmdPromp := "cmd.exe"
	arg := []string{"/c", command}
	cmd := exec.Command(cmdPromp, arg...)
	cmd.Stderr = stderr
	cmd.Stdout = stdout
	err := cmd.Run()
	if err != nil {
		return "", fmt.Errorf(stderr.String())
	}
	return cmd.String(), nil

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

What did you do?

When i have a space path of folder or filename E:\\\\My Projects\\\\Open Code in the windows cmd.run does not work with any error, but when remove space of path and filename it's work,

What did you expect to see?

Show outputd decrypt file openssl,

What did you see instead?

No error and no output

@raminfp raminfp closed this as completed Jan 26, 2022
@golang golang locked and limited conversation to collaborators Jan 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants