Skip to content

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

@raminfp

Description

@raminfp

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions