mirror of
https://github.com/rizinorg/cutter.git
synced 2025-02-22 06:33:46 +00:00
Fix stderr/stdin confusion and avoid crash on fdopen
This commit is contained in:
parent
896be642ff
commit
c07ce55581
@ -424,7 +424,9 @@ void ConsoleWidget::processQueuedOutput()
|
|||||||
while (pipeSocket->canReadLine()) {
|
while (pipeSocket->canReadLine()) {
|
||||||
QString output = QString(pipeSocket->readLine());
|
QString output = QString(pipeSocket->readLine());
|
||||||
|
|
||||||
|
if (origStderr) {
|
||||||
fprintf(origStderr, "%s", output.toStdString().c_str());
|
fprintf(origStderr, "%s", output.toStdString().c_str());
|
||||||
|
}
|
||||||
|
|
||||||
// Get the last segment that wasn't overwritten by carriage return
|
// Get the last segment that wasn't overwritten by carriage return
|
||||||
output = output.trimmed();
|
output = output.trimmed();
|
||||||
@ -449,7 +451,7 @@ void ConsoleWidget::redirectOutput()
|
|||||||
|
|
||||||
pipeSocket = new QLocalSocket(this);
|
pipeSocket = new QLocalSocket(this);
|
||||||
|
|
||||||
origStdin = fdopen(dup(fileno(stderr)), "r");
|
origStdin = fdopen(dup(fileno(stdin)), "r");
|
||||||
origStderr = fdopen(dup(fileno(stderr)), "a");
|
origStderr = fdopen(dup(fileno(stderr)), "a");
|
||||||
origStdout = fdopen(dup(fileno(stdout)), "a");
|
origStdout = fdopen(dup(fileno(stdout)), "a");
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
Loading…
Reference in New Issue
Block a user