Skip to content

Go - Ctrl+D on terminal is not rasing  #690

Description

@ronaldoapsilva

I have the following func below. After add the category I pressed Ctrl+D, but it didn't raise the error io.EOF to trigger stream.SendAndClose

To reproduce

func (c *CategoryService) CreateCategoryStream(stream pb.CategoryService_CreateCategoryStreamServer) error {
	categories := &pb.CategoryList{}

	for {
		category, err := stream.Recv()
		log.Println(category)	
		if err == io.EOF {
			return stream.SendAndClose(categories)
		}
		if err != nil {
			return err
		}

		categoryResult, err := c.CategoryDB.Create(category.Name, category.Description)
		if err != nil {
			return err
		}
		
		categories.Categories = append(categories.Categories, &pb.Category{
			Id:          categoryResult.ID,
			Name:        categoryResult.Name,
			Description: categoryResult.Description,
		})
		// log.Println(categories)		
	}
}

Expected behavior

Screenshots

image

Environment

  • OS: Ubuntu 22.04.4 LTS
  • GO: go 1.22.2
  • Terminal: bash
  • Evans version: 0.10.11
  • protoc version: libprotoc 3.12.4
  • protoc plugin version (if you are using):

Additional context

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions