Skip to content

[Bug] --cwd gets ignored when specified inside package.json script #2346

@Knagis

Description

@Knagis
  • I'd be willing to implement a fix

Describe the bug

{
  "scripts": {
    "foo": "yarn --cwd .yarn exec cd"
  }
}

Running yarn foo prints out the current path, not .yarn as specified in --cwd.

Running yarn --cwd .yarn exec cd directly in the shell produces the correct output.

To Reproduce

Use the following package.json

{
  "name": "foo",
  "version": "1.0.0",
  "license": "MIT",
  "scripts": {
    "foo": "yarn --cwd .yarn exec cd"
  }
}

Run yarn foo from the package directorty.

Environment if relevant

  • OS: Windows 10 v2004
  • Node version: 12.13.1
  • Yarn version: 2.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreproducibleThis issue can be successfully reproducedupholdedReal issues without formal reproduction

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions