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

Issue-172 query runner version and fix ruby bug Issue-162 #173

Merged
merged 6 commits into from
May 24, 2021

Conversation

eldipa
Copy link
Collaborator

@eldipa eldipa commented May 23, 2021

Closes #172 and closes #162

eldipa added 5 commits May 23, 2021 19:12
Despite receiving arguments, the method must guarantee to return the
same value always. Only then the constant decorator makes sense.

If the method may return different values for different inputs
(arguments), it would be better to use `functools.lru_cache`.

The advantage of `constant` over `functools.lru_cache` is it is
thread-safe and `byexample`'s concurrency model is aware of it.
When using `subprocess.call` and similar, the API requires a list
with the program name and its arguments.

ShebangTemplate has the correct position to offer that easily.
The method should return the version of the underlying
interpreter/runner as a tuple if possible.

If no version can be detected, it should return None (which it is the
default).
We found that in irb >= 1.2.0 the interpreter outputs nonsense.

The use of `-f`, `--nomultiline`, `--nocolorize` and `--noreadline`
fixes the problem (suggested by @fnordfish).

Because `--nomultiline` and `--nocolorize` are not valid options for irb
< 1.2.0, we require to detect the version of irb to properly choose the
correct options.

Closes #162 and closes #172
This maintains backward-compatibility with the irb < 1.2.0 behavior.
@eldipa eldipa force-pushed the Issue-172-Query-Runner-Version branch from 336a9d5 to cc226a7 Compare May 23, 2021 22:24
Allow the user to control if he/she wants the older behavior of irb
(and default for byexample) or the new one where a newline is added
after the => marker when the output is large.

To maintain backward compatibility, byexamples sets this flag to false.

This closes #162.
@eldipa eldipa merged commit 9ef4474 into master May 24, 2021
@eldipa eldipa deleted the Issue-172-Query-Runner-Version branch May 24, 2021 00:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant