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

CLIAdapter Character read problem in win10 #49

Open
404name opened this issue Aug 1, 2023 · 0 comments
Open

CLIAdapter Character read problem in win10 #49

404name opened this issue Aug 1, 2023 · 0 comments

Comments

@404name
Copy link

404name commented Aug 1, 2023

  • problem
    the minimal examples seems don't work in win10。
    as i run the examples and sent “ping” in cli there is nothing happen;

  • analyse

the problem is happen in CLIAdapter ;Actually two more characters were read;

line, err := r.ReadString('\n')
fmt.Printf("len:%d\n",  len(line))
fmt.Printf("real line: %q\n", line)
lines <- line[:len(line)-1]
<========cmd=========>
example-bot > ping
len:6
real line: "ping\r\n"

So it's never been a match,Also will never enter the pong method

regex, _ := regexp.Compile("^(?i)ping$")
matches := regex.FindStringSubmatch("ping\r")
len(matches) == 0
  • solution

i can solve it by use lines <- line[:len(line)-2] in CLIAdapter.

I don't know if other platforms or it will have an impact on other places

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant