Skip to content

Refactor CLI code and usage of os.Exit #443

Closed

Description

@rhcarvalho

I found usages of os.Exit in cmd/s2i/main.go.
That's a bad idea because it interrupts the runtime without running any deferred calls, no cleanup is done...
Most offenders call os.Exit indirectly through checkErr.

Also, the project is stuffing all CLI code in a single file, not following the standards we use in Origin.

Activity

  1. rhcarvalho commented on Apr 11, 2016

    @rhcarvalho
    ContributorAuthor
  2. rhcarvalho commented on Apr 12, 2016

    @rhcarvalho
    ContributorAuthor

    To tone down the problem, there seems to be only a single defer statement to close a file that doesn't get executed in case of errors and checkErr calling os.Exit. Not the end of the world.

    Still, looks like a beneficial cleanup to build on the ideas of the cobra usage in hugo.

  3. changed the title [-]Evil os.Exit[/-] [+]Refactor CLI code and usage of os.Exit[/+] on Jun 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions