1
0
Fork 0
mirror of https://github.com/imjasonh/testscript-rs synced 2026-07-09 01:26:40 +00:00

Address PR feedback: remove printlns and make [net] condition available by default

Co-authored-by: imjasonh <210737+imjasonh@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-09-27 02:46:34 +00:00
parent d01b8865de
commit 22499cb0ee
4 changed files with 42 additions and 8 deletions

View file

@ -169,10 +169,13 @@ impl Builder {
self
}
/// Automatically detect network availability and set the 'net' condition
/// Re-detect network availability and update the 'net' condition
///
/// The 'net' condition is automatically checked at startup, but this method
/// can be used to refresh the network status if needed.
///
/// This will attempt to ping reliable hosts to determine if network
/// connectivity is available and set the condition accordingly.
/// connectivity is available and update the condition accordingly.
pub fn auto_detect_network(mut self) -> Self {
self.params = self.params.auto_detect_network();
self

View file

@ -39,6 +39,9 @@ impl RunParams {
conditions.insert("debug".to_string(), cfg!(debug_assertions));
conditions.insert("release".to_string(), !cfg!(debug_assertions));
// Add network condition - check if network is available by default
conditions.insert("net".to_string(), Self::check_network_available());
// Check for common programs
conditions.insert("exec:cat".to_string(), Self::program_exists("cat"));
conditions.insert("exec:echo".to_string(), Self::program_exists("echo"));
@ -86,7 +89,10 @@ impl RunParams {
self
}
/// Automatically detect network availability and set the 'net' condition
/// Re-detect network availability and update the 'net' condition
///
/// The 'net' condition is automatically checked at startup, but this method
/// can be used to refresh the network status if needed.
pub fn auto_detect_network(mut self) -> Self {
self.conditions
.insert("net".to_string(), Self::check_network_available());