Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

dep status -out writes the outfile content to stdout if an error happens #1922

@jmillikin-stripe

Description

@jmillikin-stripe

What version of dep are you using (dep version)?

Current head (1208520).

What dep command did you run?

dep status -detail -v -out my-output.txt

What did you expect to see?

When dep status is given the -out flag, it writes its output to the specified file instead of stdout. I expected the same to be true if a non-fatal error occurs when fetching remote repos.

What did you see instead?

The output data was written to stdout.

Looking at

dep/cmd/dep/status.go

Lines 534 to 547 in 1208520

if cmd.outFilePath == "" {
// Print the status output
ctx.Out.Print(buf.String())
} else {
file, err := os.Create(cmd.outFilePath)
if err != nil {
return fmt.Errorf("error creating output file: %v", err)
}
defer file.Close()
if _, err := io.Copy(file, bytes.NewReader(buf.Bytes())); err != nil {
return fmt.Errorf("error writing output file: %v", err)
}
}
, this is because the errFailedUpdate check happens in a separate branch that does not inspect cmd.outFilePath.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions