Git Product home page Git Product logo

Comments (8)

cshung avatar cshung commented on May 3, 2024 1

Just an update - I am able to reproduce the issue now.

from goexpect.

skalle avatar skalle commented on May 3, 2024

Hey sfilargi.

That does make sense and shouldn't be too hard to add in. Might be a good PR for someone.
Currently a bit strapped for time so don't know when I personally could get to this so marking it as help wanted for now.

from goexpect.

cshung avatar cshung commented on May 3, 2024

I wanted to attempt this one.

from goexpect.

skalle avatar skalle commented on May 3, 2024

Hey Andrew.

Great, appreciated! .. Happy to help out with any questions you might have.

from goexpect.

cshung avatar cshung commented on May 3, 2024

Hi @skalle,
Didn't realize you offered to help until now. I had a busy week.

I stumbled on this issue rather randomly through search - I am neither an experienced go programmer, nor I am a goexpect user. I am hoping to learn more about go through this exercise, which I do.

To my surprise, setting up a repro for this problem seems harder than I wished. I have a feeling that is mostly due to my ignorance. First, I stumbled on #13, which cost me a while to figure out I have to work on Linux. Then I stumbled on #28507 because sudo apt-get install golang give me an old version of golang on Ubuntu. Last but not least, I hit a deadlock in go run process.go 1 in our example. No idea what's wrong with 1, but go run process.go 10 work just fine.

None of the issue above is really goexpect's fault, but it would be really great if people like me don't have to go through that. Maybe we can enhance our README?

Now I think it is time for me to construct an actual repro and start working on it.

from goexpect.

skalle avatar skalle commented on May 3, 2024

Yeah wish I had some cycles to fix #13, already have BSD fixed which I imagine will be quite similar to Mac.

I'm a 100% Linux user myself so might not be of much help setting things up in those environments.

About running the process.

What's done in that little example is it's really calling the linux calculator command bc -l
When it bc it calculates PI to whatever number of decimals you specify as an argument.

Let's have a look at what happens when you run it with 1 as an argument.

$ bc -l
bc 1.07.1
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006, 2008, 2012-2017 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
scale=1
4*a(1)
2.8

So when using a scale of one there it doesn't' look like PI anymore , looking at the code it tries to match the result with.

var piRE = regexp.MustCompile(3.14[0-9]*)

So 2.8 will not match that RE and the program will hang until it hits the Expect timeout.
In fact even setting scale to 2 will fail.

scale=2
4*a(1)
3.12

At three we're good again though.

scale=3
4*a(1)
3.140

This is just a small example program so not a big deal but I'd be happy to take a pull request for limiting the arg to >2 ..

As for the README and how to set up an env from scratch, I'll happily accept pull requests. :)

from goexpect.

cshung avatar cshung commented on May 3, 2024

Shall we close this issue now?

from goexpect.

skalle avatar skalle commented on May 3, 2024

Fixed by Andrew!. Thx.

from goexpect.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.