EmilyDirsh / hotwire-shell

Automatically exported from code.google.com/p/hotwire-shell
Other
0 stars 0 forks source link

history builtin does not work #192

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. type "history" and press enter

What is the expected output? What do you see instead?
I assume it is meant to give me a list of previously used commands that I
can then pipe into other commands.

Instead I just get an exception:

Traceback (most recent call last):
  File "/home/mish/dev/hotwire/hotwire/command.py", line 353, in __run
    for result in execresult:
  File "/home/mish/dev/hotwire/hotwire/state.py", line 153, in search_commands
    cursor = self.__conn.cursor()
ProgrammingError: SQLite objects created in a thread can only be used in
that same thread.The object was created in thread id 139714945906400 and
this is thread id 1084619088

What version of the product are you using? On what operating system?

Latest from svn (1252) on Ubuntu 8.04 x86_64.

Original issue reported on code.google.com by dmi...@gmail.com on 22 May 2008 at 1:23

GoogleCodeExporter commented 9 years ago
I imagine this is related to http://www.sqlite.org/faq.html#q6

So I guess the history command should make its own connection to the database, 
rather
than trying to use the connection in the History (singleton) class.

The history builtin uses search_commands() in hotwire/state.py (via 
get_history() in
hotwire/shell.py).  

Maybe the calls to the commands need to indicate whether they are part of the 
long
running thread, or just part of a command.  Or if there is only one long running
process then that thread ID could be stored in the History singleton when it is
created, and any call with a different thread ID would have it's own connection 
created.

Would that be a reasonable way to do this?

Original comment by dmi...@gmail.com on 23 May 2008 at 5:53