4

If I open a program, say evince, from the GNOME GUI, it is not attached to a terminal. If I send it a signal, it acts accordingly but nothing shows up in my terminal.

If I were to open it in a terminal to start with and allow it to run in the foreground, it would show what signals it had received.

Say I run evince as just evince from the terminal. And then in another, I run ps -e, find its PID, and then do kill -11 [PID]. It will print out "Segmentation fault (Core dumped)". For other signals, it may print "Received signal..." How can I start a terminal and have it shows signals that are sent to a program that was not started within a terminal but rather a GUI?

Is it possible to open a program in the GUI, and then attach a terminal to it so I can see the same behavior as if I had opened it from within the terminal?

user75027
  • 633
  • 1
    Shouldn't the title of your question then be: "Attach a terminal to a running process"? – Joseph R. Aug 04 '14 at 16:56
  • @JosephR. Maybe it should then be, "Get the output stream of a running process"? – goldilocks Aug 04 '14 at 17:29
  • Does this help? In all fairness, though, I tried it and it didn't work for me. I know nothing about gdb so I can't see why it's not working. – Joseph R. Aug 04 '14 at 19:46
  • 1
    @Gilles I don't quite think this is a dupe. – user75027 Aug 05 '14 at 00:45
  • If it isn't quite clear what I am asking, a program started as a GUI is not attached to any terminal to start with. How do I attach it to one? – user75027 Aug 05 '14 at 00:53
  • What do you mean by "it would show what signals it had received"? I ask, because I think that most likely it wouldn't. Typically, a GUI program like evince might show some errors and warnings (e.g. about corrupted fonts in PDFs) on its stderr (and you'd be able to see those in ~/.xsession-errors if it was GUI-launched because that's there the stderr of GUI-launched programs is usually directed to) but in the case that it receives signals like SIGTERM and SIGHUP, most likely it just dies without emitting any output. – Celada Aug 05 '14 at 01:09
  • Say I run evince as just evince from the terminal. And then in another, I ps -e, find its PID, and then do kill -11 [PID] It will print out "Segmentation fault (Core dumped)". For other signals, it may print "Received signal..."

    How can I start a terminal and have it shows signals that are sent to a program that was not started within a terminal but rather a GUI?

    – user75027 Aug 05 '14 at 01:29
  • Ah, ok, your examples clarify things. Note that messages like “Received signal…” are printed by the program, whereas “Segmentation fault (Core dumped)” is printed by the shell after the program dies. These are actually two very different questions under the hood. Do you need these messages to appear automatically on the terminal, or is it ok if you know where to look for them? – Gilles 'SO- stop being evil' Aug 05 '14 at 07:17
  • Either would be fine, automatic is preferred, but remember: I need to know where GUI programs send the messages to (and maybe how to quickly find them in that file). – user75027 Aug 05 '14 at 17:48

0 Answers0