Lines 142-147
Link Here
|
142 |
current_command_number++; |
142 |
current_command_number++; |
143 |
|
143 |
|
144 |
executing = 1; |
144 |
executing = 1; |
|
|
145 |
export_command(current_command); |
146 |
preexec_command (); |
145 |
stdin_redir = 0; |
147 |
stdin_redir = 0; |
146 |
execute_command (current_command); |
148 |
execute_command (current_command); |
147 |
|
149 |
|
Lines 226-231
Link Here
|
226 |
return (r); |
228 |
return (r); |
227 |
} |
229 |
} |
228 |
|
230 |
|
|
|
231 |
/* This is where PREEXEC_COMMAND is executed */ |
232 |
|
233 |
void |
234 |
preexec_command () |
235 |
{ |
236 |
char *command_to_execute; |
237 |
|
238 |
need_here_doc = 0; |
239 |
run_pending_traps (); |
240 |
|
241 |
if (interactive && bash_input.type != st_string) |
242 |
{ |
243 |
command_to_execute = get_string_value ("PREEXEC_COMMAND"); |
244 |
if (command_to_execute) |
245 |
execute_prompt_command (command_to_execute); |
246 |
|
247 |
if (running_under_emacs == 2) |
248 |
send_pwd_to_eterm (); /* Yuck */ |
249 |
} |
250 |
} |
251 |
|
229 |
/* Read and parse a command, returning the status of the parse. The command |
252 |
/* Read and parse a command, returning the status of the parse. The command |
230 |
is left in the globval variable GLOBAL_COMMAND for use by reader_loop. |
253 |
is left in the globval variable GLOBAL_COMMAND for use by reader_loop. |
231 |
This is where the shell timeout code is executed. */ |
254 |
This is where the shell timeout code is executed. */ |
Lines 272-274
Link Here
|
272 |
|
295 |
|
273 |
return (result); |
296 |
return (result); |
274 |
} |
297 |
} |
|
|
298 |
|
299 |
/* export_command makes an array "PREEXEC_CMD" and fills its fields |
300 |
with the command line of "command" (only for cm_simple, |
301 |
for cm_connection the last command in the chain is used */ |
302 |
|
303 |
void |
304 |
export_command (command) |
305 |
COMMAND *command; |
306 |
{ |
307 |
int i = 0; |
308 |
SHELL_VAR *cmd_var; |
309 |
ARRAY *cmd_array; |
310 |
WORD_LIST *list; |
311 |
|
312 |
if(command->type == cm_simple) |
313 |
list = command->value.Simple->words; |
314 |
else if(command->type == cm_connection) |
315 |
{ |
316 |
if(!command->value.Connection->second) |
317 |
return; |
318 |
if(command->flags == CMD_FORCE_SUBSHELL) |
319 |
command = command->value.Connection->first; |
320 |
return; |
321 |
while(command->type == cm_connection) |
322 |
command = command->value.Connection->second; |
323 |
if(command->type == cm_simple) |
324 |
list = command->value.Simple->words; |
325 |
else |
326 |
return; |
327 |
} |
328 |
else |
329 |
return; |
330 |
|
331 |
cmd_var = make_new_array_variable ("PREEXEC_CMD"); |
332 |
cmd_array = array_cell (cmd_var); |
333 |
|
334 |
while(list) |
335 |
{ |
336 |
array_insert (cmd_array, i, list->word->word); |
337 |
list=list->next; |
338 |
i++; |
339 |
} |
340 |
|
341 |
VSETATTR (cmd_var, (att_exported)); |
342 |
} |