Skip to content
This repository was archived by the owner on Jan 6, 2021. It is now read-only.
This repository was archived by the owner on Jan 6, 2021. It is now read-only.

Variable assignement is not working when the assignment requires a command execution #192

@bemipefe

Description

@bemipefe
  • cross-env version: 5.2.0
  • node version: 6.14.4
  • npm (or yarn) version: 3.10.10

Relevant code or config

"scripts": {
    "preinstall": "cross-env modarch=\"node -e console.log(process.arch)\" npm run install",
    "install": "cross-env-shell echo The variable content is $modarch",

What you did:
npm install

What happened:

The command printed the following output:
The variable content is node -e console.log(process.arch)

The expected output was:

The variable content is x64

or

The variable content is ia32

Problem description:

Instead of the command output the variable is filled with the command itself ("node -e console.log(process.arch)"). Removing the double-quotes gives syntax error.
The command runs just fine if a space character is put after "modarch=" but of course the result is never assigned to modarch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions