fortrangoingonforty/fortsh / 74d634b

Browse files

set current_command in -c mode for job descriptions

shell%current_command was only set in the interactive REPL loop.
In -c mode it stayed empty, causing background jobs to show
&#39;<background job>&#39; instead of the actual command. The POSIX job
control test checks for &#39;sleep&#39; in jobs output.

Revert sleep duration back to 0.5 — the failure was not a race.
Authored by espadonne
SHA
74d634b388abced4f181563b18e2dc765a5a3b14
Parents
4fb0983
Tree
590c6b4

2 changed files

StatusFile+-
M src/fortsh.f90 1 0
M tests/posix_compliance_jobcontrol.sh 1 1
src/fortsh.f90modified
@@ -238,6 +238,7 @@ program fortran_shell
238238
     converted_line = convert_backticks_to_dollar_paren(proc_subst_line)
239239
     ast_root => parse_command_line(converted_line)
240240
     if (associated(ast_root)) then
241
+      shell%current_command = converted_line
241242
       exit_code = execute_ast(ast_root, shell)
242243
       shell%last_exit_status = exit_code
243244
       call destroy_command_node(ast_root)
tests/posix_compliance_jobcontrol.shmodified
@@ -139,7 +139,7 @@ section "149. JOBS BUILTIN OUTPUT"
139139
 test_succeeds "jobs with no jobs" 'jobs'
140140
 test_succeeds "jobs after background" 'sleep 0.5 & jobs; wait'
141141
 # Test that jobs shows running processes
142
-test_contains "jobs shows running" 'sleep 5 & jobs' 'sleep'
142
+test_contains "jobs shows running" 'sleep 0.5 & jobs' 'sleep'
143143
 
144144
 section "150. BACKGROUND PIPELINES"
145145