@@ -6,13 +6,13 @@ use camino_tempfile::Utf8TempDir;
66use indexmap:: IndexMap ;
77#[ cfg( not( target_os = "windows" ) ) ]
88use rexpect:: session:: { PtySession , spawn_command} ;
9- #[ cfg( not( target_os = "windows" ) ) ]
10- use std:: os:: unix:: process:: ExitStatusExt ;
119use std:: {
1210 error:: Error ,
1311 io:: Write ,
1412 process:: { Command , Output } ,
1513} ;
14+ #[ cfg( not( target_os = "windows" ) ) ]
15+ use std:: { ffi:: OsStr , os:: unix:: process:: ExitStatusExt } ;
1616
1717pub fn fixture_path ( name : & str ) -> Utf8PathBuf {
1818 let mut path = Utf8PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) ;
@@ -26,7 +26,7 @@ pub fn sysand_cmd_in_with<'a, I: IntoIterator<Item = &'a str>>(
2626 cwd : & Utf8Path ,
2727 args : I ,
2828 cfg : Option < & str > ,
29- env : & IndexMap < String , String > ,
29+ env : & IndexMap < impl AsRef < OsStr > , impl AsRef < OsStr > > ,
3030) -> Result < Command , Box < dyn Error > > {
3131 let cfg_args = if let Some ( config) = cfg {
3232 let config_path = cwd. join ( "sysand.toml" ) ;
@@ -60,7 +60,7 @@ pub fn sysand_cmd_in<'a, I: IntoIterator<Item = &'a str>>(
6060 args : I ,
6161 cfg : Option < & str > ,
6262) -> Result < Command , Box < dyn Error > > {
63- sysand_cmd_in_with ( cwd, args, cfg, & IndexMap :: default ( ) )
63+ sysand_cmd_in_with ( cwd, args, cfg, & IndexMap :: < & str , & str > :: default ( ) )
6464}
6565
6666/// Creates a temporary directory and returns the tuple of the temporary
@@ -78,7 +78,7 @@ pub fn new_temp_cwd() -> Result<(Utf8TempDir, Utf8PathBuf), Box<dyn Error>> {
7878pub fn sysand_cmd < ' a , I : IntoIterator < Item = & ' a str > > (
7979 args : I ,
8080 cfg : Option < & str > ,
81- env : & IndexMap < String , String > ,
81+ env : & IndexMap < impl AsRef < OsStr > , impl AsRef < OsStr > > ,
8282) -> Result < ( Utf8TempDir , Utf8PathBuf , Command ) , Box < dyn Error > > {
8383 // NOTE had trouble getting test-temp-dir crate working, but would be better
8484 let ( temp_dir, cwd) = new_temp_cwd ( ) ?;
@@ -91,7 +91,7 @@ pub fn run_sysand_in_with<'a, I: IntoIterator<Item = &'a str>>(
9191 cwd : & Utf8Path ,
9292 args : I ,
9393 cfg : Option < & str > ,
94- env : & IndexMap < String , String > ,
94+ env : & IndexMap < impl AsRef < OsStr > , impl AsRef < OsStr > > ,
9595) -> Result < Output , Box < dyn Error > > {
9696 Ok ( sysand_cmd_in_with ( cwd, args, cfg, env) ?. output ( ) ?)
9797}
@@ -107,7 +107,7 @@ pub fn run_sysand_in<'a, I: IntoIterator<Item = &'a str>>(
107107pub fn run_sysand_with < ' a , I : IntoIterator < Item = & ' a str > > (
108108 args : I ,
109109 cfg : Option < & str > ,
110- env : & IndexMap < String , String > ,
110+ env : & IndexMap < impl AsRef < OsStr > , impl AsRef < OsStr > > ,
111111) -> Result < ( Utf8TempDir , Utf8PathBuf , Output ) , Box < dyn Error > > {
112112 let ( temp_dir, cwd, mut cmd) = sysand_cmd ( args /*, stdin*/ , cfg, env) ?;
113113
@@ -118,7 +118,7 @@ pub fn run_sysand<'a, I: IntoIterator<Item = &'a str>>(
118118 args : I ,
119119 cfg : Option < & str > ,
120120) -> Result < ( Utf8TempDir , Utf8PathBuf , Output ) , Box < dyn Error > > {
121- run_sysand_with ( args, cfg, & IndexMap :: default ( ) )
121+ run_sysand_with ( args, cfg, & IndexMap :: < & str , & str > :: default ( ) )
122122}
123123
124124// TODO: Figure out how to do interactive tests on Windows.
@@ -140,7 +140,7 @@ pub fn run_sysand_interactive_with<'a, I: IntoIterator<Item = &'a str>>(
140140 args : I ,
141141 timeout_ms : Option < u64 > ,
142142 cfg : Option < & str > ,
143- env : & IndexMap < String , String > ,
143+ env : & IndexMap < impl AsRef < OsStr > , impl AsRef < OsStr > > ,
144144) -> Result < ( Utf8TempDir , Utf8PathBuf , PtySession ) , Box < dyn Error > > {
145145 let ( temp_dir, cwd, cmd) = sysand_cmd ( args, cfg, env) ?;
146146
@@ -153,7 +153,7 @@ pub fn run_sysand_interactive<'a, I: IntoIterator<Item = &'a str>>(
153153 timeout_ms : Option < u64 > ,
154154 cfg : Option < & str > ,
155155) -> Result < ( Utf8TempDir , Utf8PathBuf , PtySession ) , Box < dyn Error > > {
156- run_sysand_interactive_with ( args, timeout_ms, cfg, & IndexMap :: default ( ) )
156+ run_sysand_interactive_with ( args, timeout_ms, cfg, & IndexMap :: < & str , & str > :: default ( ) )
157157}
158158
159159// TODO: Figure out how to do interactive tests on Windows.
0 commit comments