Bug 124681 - Shell script does not open in Konsole.
Summary: Shell script does not open in Konsole.
Status: RESOLVED NOT A BUG
Alias: None
Product: kdelibs
Classification: Unmaintained
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Stephan Kulow
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-01 01:03 UTC by tkaitchuck
Modified: 2023-02-28 14:11 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Proof of concept (550 bytes, application/x-shellscript)
2006-04-05 05:06 UTC, tkaitchuck
Details
Helper Script (230 bytes, application/x-shellscript)
2006-04-05 05:07 UTC, tkaitchuck
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tkaitchuck 2006-04-01 01:03:02 UTC
Version:           3.5.1 (using KDE 3.5.1, Debian Package 4:3.5.1-2 (testing/unstable))
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.12-1-k7

When a user has a shell script that is marked as executable and they click on it in Konqueror, it executes. However it does not open a console window, so if the script requires command line user interaction it simple dies and the user does not know why. What should happen is when a user clicks an executable file in Konqueror that from the mimetype information can be determined to be of a type that normally runs in a terminal window to open and run it in the user's preferred console as determined by their control center settings.
Comment 1 Thiago Macieira 2006-04-04 02:32:28 UTC
How does the MIME type say that it should open in a terminal window?

Not all shell scripts are Terminal-based. You cannot generalise.
Comment 2 tkaitchuck 2006-04-04 03:33:28 UTC
If that generalization is not acceptable then the solution is to allow it to execute and have the parent thread monitor the output and wait for it to read from stdin, and then if ether occurs to open a terminal and display the output that was produced or to allow the user to type the input. This is of course a lot more complicated than simply always opening a terminal for all scripts. Never the less simply killing the process (or worse, letting it go into an infinite loop) with no user feedback to indicate that it is running or was launched, or that there was a problem is not a solution.
Comment 3 Thiago Macieira 2006-04-04 08:54:32 UTC
Once the child process has started, you can't change it. I can't be reparented either. So there's no way to transfer it to a terminal after it has started without one.

There's no solution to this problem that I can see.
Comment 4 tkaitchuck 2006-04-05 05:06:11 UTC
Created attachment 15464 [details]
Proof of concept

This script launches the IO of the program specified on the command line in a
konsole after it has started executing but only if it produces some output. A
similar script could be used for input as the command `echo -n ""` will block
on output to be available but not write anything to it.
Comment 5 tkaitchuck 2006-04-05 05:07:01 UTC
Created attachment 15465 [details]
Helper Script
Comment 6 Thiago Macieira 2006-04-05 09:04:28 UTC
If you can do that using terminals (not FIFOs), it's something to reconsider.

It has to be a terminal because many programs may try isatty(3) to determine whether they are running in a terminal or if input has been redirected.
Comment 7 tkaitchuck 2006-04-05 23:42:35 UTC
Sure that is not a problem, it's not that different then what I did in the script. Have an application that opens a /dev/pts/# entry launch the program using these as it's input and output. Then have two treads one which blocks on trying to write the other on trying to read if ether of them unblock, then spawn a terminal and execute the following in it:
cat /dev/pts/# &
cat >> /dev/pts/#
where # is the number you used. Then that process will "take over" the /dev/pts/# and make it look as though this input and output came from one terminal when it came from the other. You can test this by opening 2 terminals and finding the tty number of each, then run the two cat commands on the other, and you get all the io for the other terminal. This of course is not useful as you cannot run anyting on the other terminal for this to work, and as soon as you type input the forground cat will take over the display and you won't see anymore output until you switch back to the other cat. However if you connected a process up to each of these (and wrote it in some language other than bash so you did not have to wait for a return for data to be sent) this could be a useful mechanism.
Comment 8 Thiago Macieira 2006-04-06 09:26:17 UTC
Sounds doable.
Comment 9 Stephan Kulow 2023-02-28 14:11:26 UTC
Closing old bugs