Skip to content

Newlines in arguments passed to node -e ... #1791

@julienp

Description

@julienp

We ran into an issue when calling node -e ... with a script that contains new lines. pulumi/pulumi#16649

Repro:

main.go:

package main

import (
	"fmt"
	"os/exec"
)

func main() {
	argWithNewLines := `if (true) {
		console.log("it's true!");
	}`
	cmd := exec.Command("node", "-e", argWithNewLines)
	out, err := cmd.Output()
	if err != nil {
		fmt.Printf("Error: %s", err)
	}
	fmt.Println(string(out))
}

Run with:

go run main.go

When I have the Volta shim node.exe in the path, I get an error:

PS C:\Users\pulumiadmin> go run main.go
Error: exit status 1

With the actual node.exe on path, it works:

PS C:\Users\pulumiadmin> go run main.go
it's true!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions