views:

213

answers:

3

I'd like to be able to launch a process from a GUI application (right now I'm thinking specifically of letting an eclipse user -- possibly via a plugin -- click a button to launch a build using my organization's build system).

I don't want this process to stop when I stop the parent application, and I want to be able to "switch into it" later, as though I launched it from a command line.

I've seen GNU screen described as good for most of what I'm asking for, but I'm not sure about the "launch the process from another application" part.

Can this be done if the GUI application was itself launched from within screen? Can this be done if it wasn't? I'd be very interested in seeing how!

Update: Prepending "screen" to a command line looks like a good way to start a process in screen from a shell, but I'm trying to find a way to do this without being taken straight into that session. I want to "send" the command to a screen session, where it will be started in a new window in that session.

+2  A: 

simply prepend the 'screen' command to your normal commandline.

E.g. if you normally execute "./make_build.sh opt1 opt" then your screenified commandline would be "screen ./make_build.sh opt1 opt2"

Its that easy! :-)

Will
Using the -S option 'screen -S <name> ...' allow for conveniently reconnecting to screen with 'screen -r <name>'. No need to use the pid for reconnecting.
Ruben
This is good, but it seems to always open the screen in the foreground. I'd love to be able to "background the task into a screen session" where I can go attach to it later. Ideally would be to open up a new window in an existing screen session, creating a new session only if needed.
Charlie
"man screen" gives you the manual.http://www.slac.stanford.edu/comp/unix/package/epics/extensions/iocConsole/screen.1.htmlLooks like the "-d" switch is the one you want: "Start screen in 'detached' mode"
Will
A: 

You can send screen messages to a running screen session with the -X flag.

See http://stackoverflow.com/questions/1236376/how-to-start-a-new-process-in-a-new-window-in-an-existing-gnu-screen-session-fro or the screen man pages.

alberge
A: 

If you can suspend the process (via Cont-Z) you can then run

screen -dr -X screen $(fg)

It will attach that process to a new window in the screen. Its not ideal, but it will work.

Ethan