Comments (8)
Just an update - I am able to reproduce the issue now.
from goexpect.
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.
I wanted to attempt this one.
from goexpect.
Hey Andrew.
Great, appreciated! .. Happy to help out with any questions you might have.
from goexpect.
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.
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.
Shall we close this issue now?
from goexpect.
Fixed by Andrew!. Thx.
from goexpect.
Related Issues (20)
- Go 1.13: Spawn fails with "operation not permitted" HOT 3
- Useless break statement HOT 1
- go (-buildmode=shared not supported on windows/amd64)
- Is maintenance stopped HOT 1
- Redirect non-verbose logging
- scp lager file timeout
- Multiple lines of output are causing timeouts HOT 3
- Setctty set but Ctty not valid in child HOT 1
- Why goexpect use TeeWriter to handle both stdout and stderr HOT 3
- `Expect` wouldn't work when GenericSpawn a `ssh user@address` command HOT 1
- How to send 'Ctrl-C' to the interactive shell spawned by SpawnWithArgs HOT 2
- Receive bufferSize should be configurable HOT 1
- Example link does not reference goexpect HOT 3
- Please define errors HOT 1
- when using goroutines, the connection is timed out
- How to get stdout or stderr?
- How to check if the match succeeded? HOT 1
- goterm is too old
- Having two SpawnGeneric, each with different verbosity configuration
- Send file over SSH
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goexpect.