aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorChristian Parpart <christian@parpart.family>2018-07-17 19:08:10 +0800
committerGitHub <noreply@github.com>2018-07-17 19:08:10 +0800
commit1d33f41c1ab96746b97b97f79732ec23759fb8f0 (patch)
tree08da6b18717191b46031081dcc9db5d231671b08 /test
parent56096e9ce827b62dbb657138acb304f79be2278c (diff)
parent05121eebd1f219e9ae1cdf79afa8d0201ad7975a (diff)
downloaddexon-solidity-1d33f41c1ab96746b97b97f79732ec23759fb8f0.tar
dexon-solidity-1d33f41c1ab96746b97b97f79732ec23759fb8f0.tar.gz
dexon-solidity-1d33f41c1ab96746b97b97f79732ec23759fb8f0.tar.bz2
dexon-solidity-1d33f41c1ab96746b97b97f79732ec23759fb8f0.tar.lz
dexon-solidity-1d33f41c1ab96746b97b97f79732ec23759fb8f0.tar.xz
dexon-solidity-1d33f41c1ab96746b97b97f79732ec23759fb8f0.tar.zst
dexon-solidity-1d33f41c1ab96746b97b97f79732ec23759fb8f0.zip
Merge pull request #4463 from ethereum/isoltest-colors-on-windows
isoltest: adds support for properly handling ANSI escape sequences on Windows
Diffstat (limited to 'test')
-rw-r--r--test/tools/isoltest.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/tools/isoltest.cpp b/test/tools/isoltest.cpp
index 41dff148..ed4f148e 100644
--- a/test/tools/isoltest.cpp
+++ b/test/tools/isoltest.cpp
@@ -29,6 +29,10 @@
#include <fstream>
#include <queue>
+#if defined(_WIN32)
+#include <windows.h>
+#endif
+
using namespace dev;
using namespace dev::solidity;
using namespace dev::solidity::test;
@@ -242,8 +246,30 @@ TestStats TestTool::processPath(
}
+void setupTerminal()
+{
+#if defined(_WIN32) && defined(ENABLE_VIRTUAL_TERMINAL_PROCESSING)
+ // Set output mode to handle virtual terminal (ANSI escape sequences)
+ // ignore any error, as this is just a "nice-to-have"
+ // only windows needs to be taken care of, as other platforms (Linux/OSX) support them natively.
+ HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
+ if (hOut == INVALID_HANDLE_VALUE)
+ return;
+
+ DWORD dwMode = 0;
+ if (!GetConsoleMode(hOut, &dwMode))
+ return;
+
+ dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
+ if (!SetConsoleMode(hOut, dwMode))
+ return;
+#endif
+}
+
int main(int argc, char *argv[])
{
+ setupTerminal();
+
if (getenv("EDITOR"))
TestTool::editor = getenv("EDITOR");
else if (fs::exists("/usr/bin/editor"))