ioquatix / script-runner

This package will run various script files inside of Atom. It currently supports JavaScript, CoffeeScript, Ruby, and Python. You can add more.
http://atom.io/packages/script-runner
Other
62 stars 23 forks source link

Output from SQL query truncated even if scrollback is large enough. #60

Closed beaucoder closed 7 years ago

beaucoder commented 7 years ago

Running SQLite3 Query in Ruby 2.3.3 on Linux / Ubuntu 16.04. 387 lines produced in query but only 217 show in script-runner. Scrollback of 555 or larger (up t0 3,000) does not help.

How to fix?

Thank you, Ken Wagner beaucoder@gmail.com

huba commented 7 years ago

It's possible that the scrollback option doesn't do anything since we switched to use termjs.

I'll see if it's possible to make termjs respect the option, but be warned it's probably going to get a bit choppy rendering 3000+ lines.

beaucoder commented 7 years ago

Hi Huba,

Only a very, very few queries are that large.

Most are under 1,000.

Any help would be greatly appreciated as Script-runner is hugely helpful.

Many thanks,

Ken Wagner

On 01/01/2017 06:08 PM, Huba Nagy wrote:

It's possible that the scrollback option doesn't do anything since we switched to use termjs.

I'll see if it's possible to make termjs respect the option, but be warned it's probably going to get a bit choppy rendering 3000+ lines.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ioquatix/script-runner/issues/60#issuecomment-269925857, or mute the thread https://github.com/notifications/unsubscribe-auth/AAE6sJ4JxLsRE5QDcH8wGtd_YYsQmFqQks5rOEAJgaJpZM4LYyKF.

ioquatix commented 7 years ago

Uh, the scroll back option does still work but it might have changed the name, however I wonder if this is really the issue. we need to reproduce this issue with a simple script, e.g. generate 500 lines of output and see what is visible/scrollable.

beaucoder commented 7 years ago

Hi Samuel,

The output varies from about 170 to 260 lines or so out of 347 total. Depends somewhat on just when I hit Alt + x. Using Ubuntu 16.04, Ruby 2.3.3, SQLite3 3.15.2. It's a simple script using the SQLite3 chinook.db sample DB:

"select title, name from albums, artists where albums.artistid = artists.artistid order by name;".

Yields 347 rows. Script-runner shows random numbers as noted above, but never all whether using the default 555 scrollback or other numbers.

When executing the Ruby script directly in a terminal the rows are always complete. Just not in Scirpt-Runner.

If you "select * from tracks;" you will get tons of lines: 3,503.

To duplicate: download the chinook.db from Sqlite web site. Use Ruby and 'sqlite3-ruby' with "require 'sqlite3' to execute a SQL query. Then use 'puts' to show each row in the terminal screen.

Any questions, let me know.

Regards,

Ken Wagner

On 01/02/2017 05:30 AM, Samuel Williams wrote:

Uh, the scroll back option does still work but it might have changed the name, however I wonder if this is really the issue. we need to reproduce this issue with a simple script, e.g. generate 500 lines of output and see what is visible/scrollable.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ioquatix/script-runner/issues/60#issuecomment-269961028, or mute the thread https://github.com/notifications/unsubscribe-auth/AAE6sLWaqgJrqCx1jJe1uhIGV0oF70nlks5rON_lgaJpZM4LYyKF.

ioquatix commented 7 years ago

Let me get this straight, a simple query against the database gives 3,500 lines of output correctly, but a more complex query truncates the data arbitrarily?

huba commented 7 years ago

Well, this is quite weird. I did:

0..500.times do |n|
    puts "%5d another one!" % n
end

and it only partially prints line 331 before it finishes. see here

It seems like the pty gets destroyed too soon.

ioquatix commented 7 years ago

ah interesting, yeah that makes sense (pty getting destroyed too soon). I guess I need to look at the correct way to know that the output is complete and the process is finished.

beaucoder commented 7 years ago

Thank, Samuel, for your prompt reply.

Script-runner is a jewel. Very much appreciated.

Regards,

Ken Wagner

On 01/02/2017 06:12 AM, Samuel Williams wrote:

ah interesting, yeah that makes sense (pty getting destroyed too soon). I guess I need to look at the correct way to know that the output is complete and the process is finished.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ioquatix/script-runner/issues/60#issuecomment-269964864, or mute the thread https://github.com/notifications/unsubscribe-auth/AAE6sFIV-Q8ZMWGlyooDsOBi3BrCyJ3Hks5rOOmzgaJpZM4LYyKF.

beaucoder commented 7 years ago

Yeah, exactly. Thanks for your efforts and promptness.

Regards,

Ken Wagner

On 01/02/2017 06:07 AM, Huba Nagy wrote:

Well, this is quite weird. I did:

0..500.timesdo |n| puts"%5d another one!" % n end

and it only partially prints line 331 before it finishes. see here http://imgur.com/a/sgoWS

It seems like the pty gets destroyed too soon.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ioquatix/script-runner/issues/60#issuecomment-269964362, or mute the thread https://github.com/notifications/unsubscribe-auth/AAE6sKYDyuBxgw0iqMC1XYAOQF28TogRks5rOOhvgaJpZM4LYyKF.

beaucoder commented 7 years ago

No, No, No!!

Only 150 to 260 lines ever print. It varies.

Does not matter if the query is simple (select * from xxx;) or complex.

For testing you can use the 3503 row query if you wish.

Huba Nagy is also working on this. TYLTK.

Regards,

Ken Wagner

On 01/02/2017 05:59 AM, Samuel Williams wrote:

Let me get this straight, a simple query against the database gives 3,500 lines of output correctly, but a more complex query truncates the data arbitrarily?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ioquatix/script-runner/issues/60#issuecomment-269963678, or mute the thread https://github.com/notifications/unsubscribe-auth/AAE6sIlys498g8yZ3mm8schCH_hdtzkGks5rOOa-gaJpZM4LYyKF.

ioquatix commented 7 years ago

@beaucoder I've updated to node-pty and I can't reproduce this issue on macOS. I'll also test on linux. It's released as v2.1.0 today.

ioquatix commented 7 years ago

@beaucoder Can you please check if this is still an issue, and if it is let us know.