Files
tdesktop/Telegram/ThirdParty/kcoreaddons/autotests/kprocesstest_helper.cpp
allhaileris afb81b8278
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
init
2026-02-16 15:50:16 +03:00

35 lines
873 B
C++

/*
This file is part of the KDE libraries
SPDX-FileCopyrightText: 2007 Oswald Buddenhagen <ossi@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "kprocesstest_helper.h"
#include <kprocess.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
if (argc < 2) {
printf("Missing parameter");
return -1;
}
KProcess p;
p.setShellCommand(QString::fromLatin1("echo " EOUT "; echo " EERR " >&2"));
p.setOutputChannelMode(static_cast<KProcess::OutputChannelMode>(atoi(argv[1])));
fputs(POUT, stdout);
fflush(stdout);
p.execute();
fputs(ROUT, stdout);
fputs(p.readAllStandardOutput().constData(), stdout);
fputs(RERR, stdout);
if (p.outputChannelMode() != KProcess::MergedChannels) {
fputs(p.readAllStandardError().constData(), stdout);
}
return 0;
}