mirror of
https://github.com/nestriness/cdc-file-transfer.git
synced 2026-01-30 12:25:35 +02:00
Adds a function to filter ANSI escape sequences from a string. Executing SSH commands on Windows yields output that is full of ANSI escape sequences if the "-tt" (forced TTY) argument is used. One particular escape sequence sets the window title to "c:\windows\system32\cmd.exe". This string is null terminated and messes with parsing the actual output later in that string. The filter function removes those escape sequences. The outout is still a bit messed up, even after removing escape sequences. Some sequences delete rows and move the cursor. Without properly interpreting these sequences it doesn't seem possible to retrieve the proper output. In a future CL the -tt argument is removed on Windows, which removes the necessity to filter ANSI codes. However, sometimes the target architecture is not known (yet), so that it is still useful to filter ANSI codes in that case to print useful debug output.
50 lines
1.4 KiB
Python
50 lines
1.4 KiB
Python
load("@rules_cc//cc:defs.bzl", "cc_binary")
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
# Using a cc_binary rule here to avoid that this test is included when running
|
|
# test from bazel directly. This target is just a convenience target for all the
|
|
# unit tests in the scope run from Visual Studio, thus running the following
|
|
# command would execute all tests twice:
|
|
#
|
|
# bazel test --build_tests_only //...
|
|
#
|
|
# To run this target with Bazel directly, just use "bazel run" instead of
|
|
# "bazel test".
|
|
cc_binary(
|
|
name = "tests_common",
|
|
testonly = True,
|
|
srcs = [
|
|
"//common:all_test_sources",
|
|
],
|
|
data = [
|
|
"//common:all_test_data",
|
|
],
|
|
deps = [
|
|
"//common:ansi_filter",
|
|
"//common:buffer",
|
|
"//common:dir_iter",
|
|
"//common:file_watcher",
|
|
"//common:gamelet_component",
|
|
"//common:log",
|
|
"//common:path",
|
|
"//common:path_filter",
|
|
"//common:platform",
|
|
"//common:port_manager",
|
|
"//common:port_range_parser",
|
|
"//common:process",
|
|
"//common:remote_util",
|
|
"//common:sdk_util",
|
|
"//common:semaphore",
|
|
"//common:status_test_macros",
|
|
"//common:stopwatch",
|
|
"//common:stub_process",
|
|
"//common:test_main",
|
|
"//common:testing_clock",
|
|
"//common:thread_safe_map",
|
|
"//common:threadpool",
|
|
"//common:url",
|
|
"//common:util",
|
|
],
|
|
)
|