2016-12-16 1 views
0

Ich versuche, Konsolenprotokoll eines Prozesses, der von einem übergeordneten Prozess (program is coded in Qt) hervorgebracht wird. Seltsamerweise sind Stout und Stoderror Pipes. Wie sollte ich die Konsolenprotokolle anzeigen?Linux-Konsole Protokolle für den Prozess mit STDOUT als Pipe

Verfahren A (14543 ist die pid von A) -> Starten Prozess B (14552 ist die pid von B)

ich die Konsolenprotokolle von Prozess A. sehen

[email protected]:/$ 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] 

[email protected]:/$ 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 

Antwort

2

Was das ist Problem mit QProcess()? Sie können ein Kind-Prozess mit QProcess und [lesen] run/schreiben [stderr/stdou]/stdout mit normalen QIODevice Lese-/Schreib ruft

Hier ist Beispiel: read QProcess output to string

+0

Problem ist nicht mit QProcess, für PID 14543 FD 1 ist/dev/pts/21. Problem ist mit dem zweiten QProcess (PID 14552) FD 1 ist -> pipe: [8968051]. Wie sehe ich die Ausgabe einer Pipe? – Kamath

+1

Die Pipes sind Standardausgänge, sie werden bereits von Qt verarbeitet. Sie müssen nur QProcess :: readAllStandardOutput() oder andere Methoden aufrufen, um Standardausgaben zu lesen –

Verwandte Themen