summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/testConsoleBufChild.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-09-14 13:41:55 (GMT)
committerBrad King <brad.king@kitware.com>2016-09-14 13:41:55 (GMT)
commite4fc770fa39f8433147cae4849923286e5b3511a (patch)
treea46db42095c88d36520f49f9f76a289bb304892a /Source/kwsys/testConsoleBufChild.cxx
parenta7305ef00a70518f7abb66211ef09b0ca6d4af71 (diff)
parentb80d6136321fb6c2be019dec4af4b1e486389e2c (diff)
downloadCMake-e4fc770fa39f8433147cae4849923286e5b3511a.zip
CMake-e4fc770fa39f8433147cae4849923286e5b3511a.tar.gz
CMake-e4fc770fa39f8433147cae4849923286e5b3511a.tar.bz2
Merge branch 'upstream-KWSys' into update-kwsys
* upstream-KWSys: KWSys 2016-09-14 (e736efa1)
Diffstat (limited to 'Source/kwsys/testConsoleBufChild.cxx')
-rw-r--r--Source/kwsys/testConsoleBufChild.cxx61
1 files changed, 61 insertions, 0 deletions
diff --git a/Source/kwsys/testConsoleBufChild.cxx b/Source/kwsys/testConsoleBufChild.cxx
new file mode 100644
index 0000000..3b9ab71
--- /dev/null
+++ b/Source/kwsys/testConsoleBufChild.cxx
@@ -0,0 +1,61 @@
+/*============================================================================
+ KWSys - Kitware System Library
+ Copyright 2000-2016 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#include "kwsysPrivate.h"
+
+#include KWSYS_HEADER(ConsoleBuf.hxx)
+#include KWSYS_HEADER(Encoding.hxx)
+
+// Work-around CMake dependency scanning limitation. This must
+// duplicate the above list of headers.
+#if 0
+# include "ConsoleBuf.hxx.in"
+# include "Encoding.hxx.in"
+#endif
+
+#include <iostream>
+#include "testConsoleBuf.hxx"
+
+//----------------------------------------------------------------------------
+int main(int argc, const char* argv[])
+{
+#if defined(_WIN32)
+ kwsys::ConsoleBuf::Manager out(std::cout);
+ kwsys::ConsoleBuf::Manager err(std::cerr, true);
+ kwsys::ConsoleBuf::Manager in(std::cin);
+
+ if (argc > 1) {
+ std::cout << argv[1] << std::endl;
+ std::cerr << argv[1] << std::endl;
+ } else {
+ std::string str = kwsys::Encoding::ToNarrow(UnicodeTestString);
+ std::cout << str << std::endl;
+ std::cerr << str << std::endl;
+ }
+
+ std::string input;
+ HANDLE syncEvent = OpenEventW(EVENT_MODIFY_STATE, FALSE, SyncEventName);
+ if (syncEvent) {
+ SetEvent(syncEvent);
+ }
+
+ std::cin >> input;
+ std::cout << input << std::endl;
+ if (syncEvent) {
+ SetEvent(syncEvent);
+ CloseHandle(syncEvent);
+ }
+#else
+ static_cast<void>(argc);
+ static_cast<void>(argv);
+#endif
+ return 0;
+}