@@ -657,7 +657,11 @@ pub fn (mut v Builder) cc() {
657657 //
658658 all_args := v.all_args (v.ccoptions)
659659 v.dump_c_options (all_args)
660- str_args := all_args.join (' ' )
660+ str_args := if v.pref.no_rsp {
661+ all_args.join (' ' ).replace ('\n ' , ' ' )
662+ } else {
663+ all_args.join (' ' )
664+ }
661665 mut cmd := '${v.quote_compiler_name(ccompiler)} ${str_args} '
662666 mut response_file := ''
663667 mut response_file_content := str_args
@@ -666,21 +670,13 @@ pub fn (mut v Builder) cc() {
666670 response_file_content = str_args.replace ('\\ ' , '\\\\ ' )
667671 rspexpr := '@${response_file} '
668672 cmd = '${v.quote_compiler_name(ccompiler)} ${os.quoted_path(rspexpr)} '
669- $if windows {
670- os.write_file_array (response_file, string_to_ansi_not_null_terminated (response_file_content)) or {
671- verror ('Unable to write to C response file "${response_file} "' )
672- }
673- } $else {
674- os.write_file (response_file, response_file_content) or {
675- verror ('Unable to write to C response file "${response_file} "' )
676- }
673+ write_response_file (response_file, response_file_content)
674+ if ! v.ccoptions.debug_mode {
675+ v.pref.cleanup_files << response_file
677676 }
678677 }
679678 if ! v.ccoptions.debug_mode {
680679 v.pref.cleanup_files << v.out_name_c
681- if ! v.pref.no_rsp {
682- v.pref.cleanup_files << response_file
683- }
684680 }
685681 $if windows {
686682 if v.ccoptions.cc == .tcc {
@@ -1177,3 +1173,19 @@ pub fn (mut v Builder) quote_compiler_name(name string) string {
11771173 }
11781174 return os.quoted_path (name)
11791175}
1176+
1177+ fn write_response_file (response_file string , response_file_content string ) {
1178+ $if windows {
1179+ os.write_file_array (response_file, string_to_ansi_not_null_terminated (response_file_content)) or {
1180+ write_response_file_error (response_file_content, err)
1181+ }
1182+ } $else {
1183+ os.write_file (response_file, response_file_content) or {
1184+ write_response_file_error (response_file_content, err)
1185+ }
1186+ }
1187+ }
1188+
1189+ fn write_response_file_error (response_file string , err IError) {
1190+ verror ('Unable to write to C response file "${response_file} ", error: ${err} ' )
1191+ }
0 commit comments