@@ -1034,11 +1034,34 @@ impl CommandRunner {
10341034 }
10351035 println ! ( "{}" , sep) ;
10361036
1037- // Set environment variables
1037+ // Write sourceable exports file
1038+ let exports_file = ".stackql-deploy-exports" ;
1039+ let mut export_lines = Vec :: new ( ) ;
10381040 for ( name, val) in & rows {
1039- std:: env:: set_var ( name, val) ;
1041+ // Escape single quotes in values
1042+ let escaped = val. replace ( '\'' , "'\\ ''" ) ;
1043+ export_lines. push ( format ! ( "export {}='{}'" , name, escaped) ) ;
1044+ }
1045+ match fs:: write ( exports_file, export_lines. join ( "\n " ) + "\n " ) {
1046+ Ok ( _) => {
1047+ info ! ( "{} variables written to {}" , rows. len( ) , exports_file) ;
1048+ println ! ( ) ;
1049+ println ! ( "To load these variables into your shell:" ) ;
1050+ if cfg ! ( target_os = "windows" ) {
1051+ println ! (
1052+ " PowerShell: Get-Content {} | ForEach-Object {{ Invoke-Expression $_ }}" ,
1053+ exports_file
1054+ ) ;
1055+ println ! ( " Git Bash: source {}" , exports_file) ;
1056+ } else {
1057+ println ! ( " source {}" , exports_file) ;
1058+ }
1059+ println ! ( ) ;
1060+ }
1061+ Err ( e) => {
1062+ error ! ( "Failed to write exports file {}: {}" , exports_file, e) ;
1063+ }
10401064 }
1041- info ! ( "{} variables exported as environment variables" , rows. len( ) ) ;
10421065
10431066 // Write JSON file if --output-file was specified
10441067 if let Some ( output_file) = output_file {
0 commit comments