Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get rid of crossterm and crates dependent on it #1710

Merged
merged 7 commits into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- A bug was fixed in [#1706](https://github.com/KomodoPlatform/atomicDEX-API/pull/1706) where EVM swap transactions were failing if sent before the approval transaction confirmation.
- Tendermint account sequence problem due to running multiple instances were fixed in [#1694](https://github.com/KomodoPlatform/atomicDEX-API/pull/1694)
- Maker/taker pubkeys were added to new columns in `stats_swaps` table in [#1665](https://github.com/KomodoPlatform/atomicDEX-API/pull/1665)
- Get rid of unnecessary / old dependencies: `crossterm`, `crossterm_winapi`, `mio 0.7.13`, `miow`, `ntapi`, `signal-hook`, `signal-hook-mio` in [#1710](https://github.com/KomodoPlatform/atomicDEX-API/pull/1710)

## v1.0.0-beta - 2023-03-08

Expand Down
82 changes: 1 addition & 81 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions mm2src/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ web-sys = { version = "0.3.55", features = ["console", "CloseEvent", "DomExcepti
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
anyhow = "1.0"
chrono = "0.4"
crossterm = "0.20"
gstuff = { version = "0.7", features = ["crossterm", "nightly"] }
gstuff = { version = "0.7", features = ["nightly"] }
hyper = { version = "0.14.11", features = ["client", "http2", "server", "tcp"] }
# using webpki-tokio to avoid rejecting valid certificates
# got "invalid certificate: UnknownIssuer" for https://ropsten.infura.io on iOS using default-features
Expand Down
2 changes: 1 addition & 1 deletion mm2src/mm2_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ gstuff = { version = "0.7", features = ["nightly"] }
mm2_rpc = { path = "../mm2_rpc" }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
gstuff = { version = "0.7", features = ["crossterm", "nightly"] }
gstuff = { version = "0.7", features = ["nightly"] }
2 changes: 1 addition & 1 deletion mm2src/mm2_io/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ async-std = { version = "1.5", features = ["unstable"] }
gstuff = { version = "0.7", features = ["nightly"] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
gstuff = { version = "0.7", features = ["crossterm", "nightly"] }
gstuff = { version = "0.7", features = ["nightly"] }
2 changes: 1 addition & 1 deletion mm2src/mm2_net/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ js-sys = "0.3.27"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
hyper = { version = "0.14.11", features = ["client", "http2", "server", "tcp"] }
gstuff = { version = "0.7", features = ["crossterm", "nightly"] }
gstuff = { version = "0.7", features = ["nightly"] }
2 changes: 1 addition & 1 deletion mm2src/mm2_rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ ser_error_derive = { path = "../derives/ser_error_derive" }
gstuff = { version = "0.7", features = ["nightly"] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
gstuff = { version = "0.7", features = ["crossterm", "nightly"] }
gstuff = { version = "0.7", features = ["nightly"] }
3 changes: 1 addition & 2 deletions mm2src/mm2_test_helpers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,4 @@ gstuff = { version = "0.7", features = ["nightly"] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
chrono = "0.4"
crossterm = "0.20"
gstuff = { version = "0.7", features = ["crossterm", "nightly"] }
gstuff = { version = "0.7", features = ["nightly"] }
26 changes: 14 additions & 12 deletions mm2src/mm2_test_helpers/src/for_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use serde_json::{self as json, json, Value as Json};
use std::collections::HashMap;
use std::convert::TryFrom;
use std::env;
use std::io::Write;
use std::net::IpAddr;
use std::num::NonZeroUsize;
use std::process::Child;
Expand All @@ -36,7 +37,6 @@ cfg_native! {
use bytes::Bytes;
use futures::channel::oneshot;
use futures::task::SpawnExt;
use gstuff::ISATTY;
use http::Request;
use regex::Regex;
use std::fs;
Expand Down Expand Up @@ -859,8 +859,9 @@ pub struct RaiiDump {
#[cfg(not(target_arch = "wasm32"))]
impl Drop for RaiiDump {
fn drop(&mut self) {
use crossterm::execute;
use crossterm::style::{Color, Print, SetForegroundColor};
const DARK_YELLOW_ANSI_CODE: &str = "\x1b[33m";
const YELLOW_ANSI_CODE: &str = "\x1b[93m";
const RESET_COLOR_ANSI_CODE: &str = "\x1b[0m";

// `term` bypasses the stdout capturing, we should only use it if the capturing was disabled.
let nocapture = env::args().any(|a| a == "--nocapture");
Expand All @@ -872,15 +873,16 @@ impl Drop for RaiiDump {
let log = String::from_utf8_lossy(&log);
let log = log.trim();

if let (true, true, mut stdout) = (nocapture, *ISATTY, std::io::stdout()) {
execute!(
stdout,
SetForegroundColor(Color::DarkYellow),
Print(format!("vvv {:?} vvv\n", self.log_path)),
SetForegroundColor(Color::Yellow),
Print(log),
)
.expect("Printing to stdout failed");
// If we want to determine is a tty or not here and write logs to stdout only if it's tty,
// we can use something like https://docs.rs/atty/latest/atty/ here, look like it's more cross-platform than gstuff::ISATTY .

if nocapture {
std::io::stdout()
.write_all(format!("{}vvv {:?} vvv\n", DARK_YELLOW_ANSI_CODE, self.log_path).as_bytes())
.expect("Printing to stdout failed");
std::io::stdout()
.write_all(format!("{}{}{}\n", YELLOW_ANSI_CODE, log, RESET_COLOR_ANSI_CODE).as_bytes())
.expect("Printing to stdout failed");
} else {
log!("vvv {:?} vvv\n{}", self.log_path, log);
}
Expand Down