Commit a3e176cb authored by John van Groningen's avatar John van Groningen

obtain exit code in wait_for_finished_code_generator instead of in finish_code_generator,

because the wait system call on linux yields this value
parent 7e586074
......@@ -724,7 +724,7 @@ step intr (DGene paths (ASyncCodeGenerationWin busy_processes win_max_n_processe
with
handle_finished_code_generators busy_processes=:[|_:_] project fileinfo ps
# process_handles = {wcgp_process_handle \\ {wcgp_process_handle} <- busy_processes}
# (i,ps) = wait_for_finished_code_generator process_handles ps
# (i,exit_code,ps) = wait_for_finished_code_generator process_handles ps
| i<0
= (False,busy_processes,project,fileinfo,ps)
# (finished_process,busy_processes) = remove_finished_process_from_list i busy_processes
......@@ -734,7 +734,7 @@ step intr (DGene paths (ASyncCodeGenerationWin busy_processes win_max_n_processe
= (p,ps)
# (fp,ps) = remove_finished_process_from_list (i-1) ps;
= (fp,[p:ps])
# (ok,ps) = finish_code_generator finished_process.wcgp_process_handle finished_process.wcgp_scg updateErrorWindow ps
# (ok,ps) = finish_code_generator finished_process.wcgp_process_handle finished_process.wcgp_scg exit_code updateErrorWindow ps
| ok
# module_name = finished_process.wcgp_module_name
obj_path = finished_process.wcgp_obj_path
......
......@@ -195,5 +195,5 @@ DelayEventLoop :: !.ps -> .ps
start_code_generator :: !String !(WindowFun *GeneralSt) !Pathname !Int !Bool !CodeGenOptions !Processor !Pathname !*GeneralSt
-> (!Bool,!Int/*HANDLE*/,!StartedCodeGenerator,!*GeneralSt)
finish_code_generator :: !Int/*HANDLE*/ !StartedCodeGenerator !(WindowFun *GeneralSt) !*GeneralSt -> (!Bool,!*GeneralSt)
wait_for_finished_code_generator :: !{#Int} !*GeneralSt -> (!Int,!*GeneralSt);
finish_code_generator :: !Int/*HANDLE*/ !StartedCodeGenerator !Int !(WindowFun *GeneralSt) !*GeneralSt -> (!Bool,!*GeneralSt)
wait_for_finished_code_generator :: !{#Int} !*GeneralSt -> (!Int,!Int,!*GeneralSt);
......@@ -628,9 +628,9 @@ start_code_generator cgen` wf abc_path slot timeprofile cgo tp startupdir ps
scg_abc_path=abc_path,scg_path_without_suffix=path_without_suffix,scg_errors_file_name=errors_file_name}
= (True,process_handle,scg,ps)
finish_code_generator :: !Int/*HANDLE*/ !StartedCodeGenerator !(WindowFun *GeneralSt) !*GeneralSt -> (!Bool,!*GeneralSt)
finish_code_generator process_handle {scg_thread_handle,scg_std_error_handle,scg_abc_path,scg_path_without_suffix,scg_errors_file_name} wf ps
# (exit_code, os) = finish_process_with_redirected_std_error process_handle scg_thread_handle scg_std_error_handle 99
finish_code_generator :: !Int/*HANDLE*/ !StartedCodeGenerator !Int !(WindowFun *GeneralSt) !*GeneralSt -> (!Bool,!*GeneralSt)
finish_code_generator process_handle {scg_thread_handle,scg_std_error_handle,scg_abc_path,scg_path_without_suffix,scg_errors_file_name} exit_code wf ps
# os = finish_process_with_redirected_std_error process_handle scg_thread_handle scg_std_error_handle 99
| os<>99
= undef
# ((_, errors_not_empty, error_text),ps) = accFiles (ReadErrorsAndWarnings scg_errors_file_name) ps
......@@ -643,15 +643,23 @@ finish_code_generator process_handle {scg_thread_handle,scg_std_error_handle,scg
) ps
= (exit_code==0,ps)
wait_for_finished_code_generator :: !{#Int} !*GeneralSt -> (!Int,!*GeneralSt);
wait_for_finished_code_generator :: !{#Int} !*GeneralSt -> (!Int,!Int,!*GeneralSt);
wait_for_finished_code_generator handles ps
# n_handles = size handles
# (i,os) = WaitForMultipleObjects n_handles handles False INFINITE 99
| i>=WAIT_OBJECT_0 && i<WAIT_OBJECT_0+n_handles
= (i-WAIT_OBJECT_0,ps)
# process_n = i-WAIT_OBJECT_0
# (_,exit_code,os) = GetExitCodeProcess handles.[process_n] os
| os<>99
= undef
= (process_n,exit_code,ps)
| i>=WAIT_ABANDONED_0 && i<WAIT_ABANDONED_0+n_handles
= (i-WAIT_ABANDONED_0,ps)
= (-1,ps)
# process_n = i-WAIT_ABANDONED_0
# (_,exit_code,os) = GetExitCodeProcess handles.[process_n] os
| os<>99
= undef
= (process_n,exit_code,ps)
= (-1,-1,ps)
mangleGenerator cgen` startupdir
# (cgen`,opts) = splitOptions cgen`
......@@ -913,13 +921,12 @@ start_process_with_redirected_std_error command directory errors_file_name os
= (True,process_handle,thread_handle,std_error_handle,os)
= (False, 0, 0, 0, os)
finish_process_with_redirected_std_error :: !HANDLE !HANDLE !HANDLE !*OSToolbox -> (!Int, !*OSToolbox)
finish_process_with_redirected_std_error :: !HANDLE !HANDLE !HANDLE !*OSToolbox -> *OSToolbox
finish_process_with_redirected_std_error process_handle thread_handle std_error_handle os
# (_,exit_code,os) = GetExitCodeProcess process_handle os
(_,os) = CloseHandle std_error_handle os
# (_,os) = CloseHandle std_error_handle os
(_,os) = CloseHandle thread_handle os
(_,os) = CloseHandle process_handle os
= (exit_code, os)
= os
// PERSISTENT STUFF
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment