Ticket #2027: subshell_prompt.patch

File subshell_prompt.patch, 785 bytes (added by wjaguar, 7 years ago)
  • subshell.c

    diff -udpr src0/subshell.c src/subshell.c
    old new init_subshell (void) 
    372372{ 
    373373    /* This must be remembered across calls to init_subshell() */ 
    374374    static char pty_name[BUF_SMALL]; 
    375     char precmd[BUF_SMALL]; 
     375    char precmd[BUF_MEDIUM]; 
    376376 
    377377    switch (check_sid ()) { 
    378378    case 1: 
    init_subshell (void) 
    482482    switch (subshell_type) { 
    483483    case BASH: 
    484484        g_snprintf (precmd, sizeof (precmd), 
    485                     " PROMPT_COMMAND='pwd>&%d;kill -STOP $$'\n", 
     485                    " if [ -n \"$PROMPT_COMMAND\" ]; then PROMPT_COMMAND=\"$PROMPT_COMMAND;\"; fi;" 
     486                    " PROMPT_COMMAND=\"$PROMPT_COMMAND pwd>&%d;kill -STOP \\$\\$\"\n", 
    486487                    subshell_pipe[WRITE]); 
    487488        break; 
    488489