1- use std:: env;
21use crate :: error:: { Error , Result } ;
2+ use std:: env:: consts:: OS ;
33use std:: ffi:: { OsStr , OsString } ;
44use std:: fmt:: Debug ;
55use std:: path:: PathBuf ;
@@ -147,7 +147,7 @@ impl CommandExecutor for std::process::Command {
147147 let stderr: String ;
148148 let status: ExitStatus ;
149149
150- if env :: consts :: OS == "windows" && program. as_str ( ) . ends_with ( "pg_ctl" ) {
150+ if OS == "windows" && program. as_str ( ) . ends_with ( "pg_ctl" ) {
151151 // TODO: Processes can hang on Windows when attempting to get stdout/stderr using code
152152 // that works for Linux/MacOS; this implementation should be updated to retrieve the
153153 // values of stdout/stderr without hanging
@@ -166,9 +166,7 @@ impl CommandExecutor for std::process::Command {
166166 }
167167 debug ! (
168168 "Result: {}\n stdout: {}\n stderr: {}" ,
169- status
170- . code( )
171- . map_or( "None" . to_string( ) , |c| c. to_string( ) ) ,
169+ status. code( ) . map_or( "None" . to_string( ) , |c| c. to_string( ) ) ,
172170 stdout,
173171 stderr
174172 ) ;
@@ -191,11 +189,11 @@ impl AsyncCommandExecutor for tokio::process::Command {
191189 Some ( duration) => tokio:: time:: timeout ( duration, self . output ( ) ) . await ?,
192190 None => self . output ( ) . await ,
193191 } ?;
194- let program = self . get_program ( ) . to_string_lossy ( ) . to_string ( ) ;
192+ let program = self . as_std ( ) . get_program ( ) . to_string_lossy ( ) . to_string ( ) ;
195193 let stdout: String ;
196194 let stderr: String ;
197195
198- if std :: env :: OS == "windows" && program. as_str ( ) . ends_with ( "pg_ctl" ) {
196+ if OS == "windows" && program. as_str ( ) . ends_with ( "pg_ctl" ) {
199197 // TODO: Processes can hang on Windows when attempting to get stdout/stderr using code
200198 // that works for Linux/MacOS; this implementation should be updated to retrieve the
201199 // values of stdout/stderr without hanging
0 commit comments