Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login issues #487

Merged
merged 2 commits into from
Jan 11, 2019
Merged

Login issues #487

merged 2 commits into from
Jan 11, 2019

Commits on Jan 11, 2019

  1. login: Fix empty input prompt

    Issue rustwasm#484.
    
    PR392 inadvertantly replaced the `login` interactive process spawner
    with
    `child::run`, which is hard-coded to buffer stdout/stderr. This caused
    `login` to become essentially unusable; the user could no longer see
    interactive input prompts or error messages displayed by `npm adduser`.
    
    The code was not directly reverted because the previous version:
    1. Returned Error instead of failure::Error. (Updated to use
    `bail!`, which is consistent with `publish`.)
    2. Displayed all stderr only upon exit, rather than interactively
    displaying it. This led to repeated interactive prompts without
    informing the user why. (Updated to use `status()` which inherits
    stdin/stdout/stderr by default.)
    3. Did not provide logging. (Now duplicates the logging in
    `child::run`.)
    danwilhelm committed Jan 11, 2019
    Configuration menu
    Copy the full SHA
    0147dae View commit details
    Browse the repository at this point in the history
  2. login: Send arguments separately to npm

    All arguments were passed to `arg` inside one string when building a
    `Command`. However, using the `arg` function, "only one argument can be
    passed per use." This caused all arguments accidentally to be appended
    to the registry URL. For example: After a successful login with a
    provided `--auth_type`, the success message incorrectly displayed:
    "Logged in as asf on https://registry.npmjs.org/%20--auth_type=Basic."
    The space (%20 in hex) was caused by adding a fixed space before each
    additional argument.
    
    This commit pushes all arguments onto a `Vec<String>`. Then, the `args`
    function adds the arguments separately to the command. This removes the
    need to prepend spaces to each argument. Alternatively, `arg` could have
    been used throughout to build the command argument-by-argument. However,
    using `args` partitions the code more neatly into two distinct sections.
    danwilhelm committed Jan 11, 2019
    Configuration menu
    Copy the full SHA
    2343e97 View commit details
    Browse the repository at this point in the history