Skip to content

Linefeeds are wrong when output is redirected to file #75

Description

@cmatsuoka

When sending the output of a craft-cli application to a file we should translate CRs to LFs (and possibly remove the line padding), otherwise we end up with something like Line 1 [padding] ^M Line 2 [padding] ^M Line3 [padding].

This is the real output of snapcraft redirected to a file:

Launching instance...
Initializing parts lifecycle                                                   ^MInstalling package repositories...                                             Executing parts lifecycle...                                                   ^MInstalled package repositories
^MExecuting parts lifecycle: skip pull figlet (already ran)                      ^MExecuted: skip pull figlet (already ran)                                       Executing parts lifecycle: skip overlay figlet (already ran)
^MExecuted: skip overlay figlet (already ran)
Executing parts lifecycle: skip build figlet (already ran)                     ^MExecuted: skip build figlet (already ran)
Executing parts lifecycle: skip stage figlet (already ran)                     ^MExecuted: skip stage figlet (already ran)                                      Executing parts lifecycle: skip prime figlet (already ran)
^MExecuted: skip prime figlet (already ran)
Executed parts lifecycle
Generating snap metadata...                                                    ^MGenerated snap metadata
Creating snap package...        

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions