Skip to content

Cargo new fails with side effect when $USER env variable is not set #8783

@nixphix

Description

@nixphix

Problem
When running cargo new foo in the vscode built-in terminal it fails with error $USER env variable is not set but it does so after initializing the package repository foo so now I have repo created but it is not initialized

└── foo
    ├── .git
    └── .gitignore

The expectation is if the command fails there should be no side effect, no folder or git repo created.

Steps

  1. unset USER
  2. cargo new foo
  3. ls

Possible Solution(s)
discover_author bails when $USER is not found, so it should be called before init_vcs

Notes

Output of cargo version:
cargo 1.47.0 (f3c7e066a 2020-08-28)

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