@@ -67,16 +67,27 @@ impl DependencyInstaller for OpenTofuInstaller {
6767 } ) ;
6868 }
6969
70- // Make script executable
71- debug ! ( "Making installer script executable" ) ;
72- fs:: set_permissions (
73- script_path,
74- std:: os:: unix:: fs:: PermissionsExt :: from_mode ( 0o755 ) ,
75- )
76- . map_err ( |e| InstallationError :: CommandFailed {
77- dependency : Dependency :: OpenTofu ,
78- source : e,
79- } ) ?;
70+ // Make script executable (Unix-specific)
71+ #[ cfg( unix) ]
72+ {
73+ debug ! ( "Making installer script executable" ) ;
74+ fs:: set_permissions (
75+ script_path,
76+ std:: os:: unix:: fs:: PermissionsExt :: from_mode ( 0o755 ) ,
77+ )
78+ . map_err ( |e| InstallationError :: CommandFailed {
79+ dependency : Dependency :: OpenTofu ,
80+ source : e,
81+ } ) ?;
82+ }
83+
84+ #[ cfg( not( unix) ) ]
85+ {
86+ return Err ( InstallationError :: InstallationFailed {
87+ dependency : Dependency :: OpenTofu ,
88+ message : "OpenTofu installation is only supported on Unix-like systems" . to_string ( ) ,
89+ } ) ;
90+ }
8091
8192 // Run installer with sudo
8293 debug ! ( "Running OpenTofu installer with sudo" ) ;
@@ -90,8 +101,8 @@ impl DependencyInstaller for OpenTofuInstaller {
90101
91102 if !output. status . success ( ) {
92103 let stderr = String :: from_utf8_lossy ( & output. stderr ) ;
93- // Clean up script before returning error
94- drop ( fs:: remove_file ( script_path) ) ;
104+ // Clean up script before returning error (ignore cleanup errors)
105+ fs:: remove_file ( script_path) . ok ( ) ;
95106 return Err ( InstallationError :: InstallationFailed {
96107 dependency : Dependency :: OpenTofu ,
97108 message : format ! ( "Installer script failed: {stderr}" ) ,
0 commit comments