0

I am trying to get console log of a process, that is spawned by a parent process (program is coded in Qt). Strangely the stdout and stderror are pipes. How should I view the console logs ?

Process A (14543 is the pid of A) -> Launch Process B (14552 is the pid of B)

I can see the console logs of Process A.

tux@kamath:/$ ls -l /proc/14552/fd/
total 0
lr-x------ 1 tux tux 64 Dec 16 11:17 0 -> pipe:[8968050]
l-wx------ 1 tux tux 64 Dec 16 11:17 1 -> pipe:[8968051]
l-wx------ 1 tux tux 64 Dec 16 11:15 2 -> pipe:[8968052]

tux@kamath:/$ ls -l/proc/14543/fd

total 0
lrwx------ 1 tux tux 64 Dec 16 11:25 0 -> /dev/pts/21
lrwx------ 1 tux tux 64 Dec 16 11:25 1 -> /dev/pts/21
lrwx------ 1 tux tux 64 Dec 16 11:15 2 -> /dev/pts/21
Kamath
  • 4,461
  • 5
  • 33
  • 60

1 Answers1

2

What's the problem with QProcess() ? You can run a child process with QProcess and [read]/write to [stderr/stdou]/stdout with normal QIODevice read/write calls

Here is example : read QProcess output to string

Community
  • 1
  • 1
e.jahandar
  • 1,715
  • 12
  • 30
  • Problem is not with QProcess, for PID 14543 FD 1 is /dev/pts/21. Problem is with second QProcess (PID 14552) FD 1 is -> pipe:[8968051]. How do I see the output of a pipe ? – Kamath Dec 16 '16 at 09:55
  • 1
    The pipes are standard outputs, they're handled by Qt already. you just have to call QProcess::readAllStandardOutput() or other methods to read standard outputs – e.jahandar Dec 16 '16 at 10:09