Giter Site home page Giter Site logo

HighLine#ask crashes on suspend about highline HOT 8 CLOSED

jeg2 avatar jeg2 commented on July 18, 2024
HighLine#ask crashes on suspend

from highline.

Comments (8)

JEG2 avatar JEG2 commented on July 18, 2024

Thanks for reporting this. I'll try to look into it when I have some time.

from highline.

mickeyreiss avatar mickeyreiss commented on July 18, 2024

No problem. If you have a sense of what type of bug this or maybe have a chance to confirm it is a real issue, is be happy to dig into the code a bit. :octocat:

On Oct 30, 2013, at 19:55, James Edward Gray II [email protected] wrote:

Thanks for reporting this. I'll try to look into it when I have some time.


Reply to this email directly or view it on GitHub.

from highline.

abinoam avatar abinoam commented on July 18, 2024

I couldn't reproduce the crash. But in a macosx 10.9.4 and bash 4.3 Ctrl-Z in the middle of the input has unpredictable consequences on what #ask returns. Need futher investigation.

from highline.

abinoam avatar abinoam commented on July 18, 2024

Just taking note of this gist. Perhaps relevant.
https://gist.github.com/zdennis/3a0b685047ac086725b0

from highline.

zdennis avatar zdennis commented on July 18, 2024

@abinoam, thanks for looping me in here. This may very well be related. When you say:

Ctrl-Z in the middle of the input has unpredictable consequences on what #ask returns

Can you describe what you're seeing? Is it that one or more characters may be often be missing?

from highline.

abinoam avatar abinoam commented on July 18, 2024

Hi @zdennis

I have tried again with HighLine 1.7.1
A simple #ask as in:

#!/usr/bin/env ruby

require 'highline/import'

anything = ask("Anything?  ")
puts "You told #{anything}"

If you type something, then CTRL-Z, do something, and then fg, then you type another thing and then type enter.
HighLine just "drop" the first 'typing' and then shows you the last one (the one that you typed after the fg).

Well, but there's the "readline" mode, the noecho mode and etc. that I didn't tested.

So, IMHO, we shouldn't put too much (I mean any) effort in fixing this now.
HighLine will soon be under a major refactor.
So, with a cleaner code base I think it would be easy for you to hunt this bug (in case it persists).

from highline.

abinoam avatar abinoam commented on July 18, 2024

I've just tested for this behavior again with Ruby 3.2 and ubuntu 22.04.

The problem happens with "pure" gets

Try

ruby -e "p gets"

First type "first"
Then hit ctrl-Z
Then type "second" and hit <enter>
The returned string will be only "second"

I think suspending the process is flushing the input buffer.
If it affects Kernel#gets it's probably the intended behavior to flush the input buffer when suspending, but I'm not sure.

from highline.

abinoam avatar abinoam commented on July 18, 2024

I've just tried with bash and the behavior is the same

#!/bin/bash

printf "Type: "

read astring

echo $astring

I'm closing this as a "non bug" meanwhile, but feel free to comment or reopen it @mickeyreiss if you want to discuss it any further.
Sorry for taking so long to answer this issue. I'm taking some time now to clean up them all these days.

from highline.

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.