diff options
author | hjk <hjk@qt.io> | 2023-04-14 10:00:08 +0200 |
---|---|---|
committer | hjk <hjk@qt.io> | 2023-05-17 08:21:09 +0000 |
commit | 8f5703a7b9c5b4a272b44c85aa428dd3992bb13d (patch) | |
tree | 745b7a750b6759d2cf86933690443631d72af8c8 /tests | |
parent | db2b09f4ebc20d8a8f624cdc32de130e8030b780 (diff) | |
download | qt-creator-8f5703a7b9c5b4a272b44c85aa428dd3992bb13d.tar.gz |
Tests: Add a test to feed shells via stdin
Change-Id: I7e19537d0a3015aeb329849758cc92da17a67606
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/utils/process/tst_process.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/utils/process/tst_process.cpp b/tests/auto/utils/process/tst_process.cpp index fd11c5d463..589adbb6fa 100644 --- a/tests/auto/utils/process/tst_process.cpp +++ b/tests/auto/utils/process/tst_process.cpp @@ -160,6 +160,7 @@ private slots: void quitBlockingProcess_data(); void quitBlockingProcess(); void tarPipe(); + void stdinToShell(); void cleanupTestCase(); @@ -1519,6 +1520,21 @@ void tst_Process::tarPipe() QCOMPARE(sourceFile.fileSize(), destinationFile.fileSize()); } +void tst_Process::stdinToShell() +{ + // proc.setCommand({"cmd.exe", {}}); - Piping into cmd.exe does not appear to work. + if (HostOsInfo::isWindowsHost()) + QSKIP("Skipping env test on Windows"); + + Process proc; + proc.setCommand({"sh", {}}); + proc.setWriteData("echo hallo"); + proc.runBlocking(); + + QString result = proc.readAllStandardOutput().trimmed(); + QCOMPARE(result, "hallo"); +} + QTEST_GUILESS_MAIN(tst_Process) #include "tst_process.moc" |