View Single Post
Old 08-04-2017, 03:18 AM   #745
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Quote:
Originally Posted by itwtx View Post
I would like to also suggest a simple improvement.

While debugging an issue I reported earlier, I gave a try to kbterminal.
I discovered that it does not support basic shell features, such as stream redirection.

My guess would be (since I don't have access to the source code, I can only guess), this happens because the program just splits the input string and calls one of the exec functions on it.
A simple improvement to functionality would be to call "/bin/sh -c" and pass an input string as an argument to it. This way, shell itself will parse the string and launch/redirect everything.

To illustrate (using python), if now the code looks something like
cmd_args = cmd_string.split()
os.execvp(cmd_args[0], cmd_args)
I propose to replace it with
os.execv('/bin/sh', ['sh', '-c', cmd_string])
Did you try to switch to "file mode" (I cannot remember whether this is the actual name. I did not see kbterminal myself for a long time. I think it is the leftmost button.)? With "file mode" selected, cmd_string is written to a file, and the file executed. Does this work for your needs?

Last edited by tshering; 08-04-2017 at 04:20 AM.
tshering is offline   Reply With Quote