Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: precmd: write error: interrupted
- X-seq: zsh-users 17779
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: precmd: write error: interrupted
- Date: Thu, 25 Apr 2013 11:27:11 -0700
- In-reply-to: <klbq25$osh$1@ger.gmane.org>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <klbmnc$ieh$1@ger.gmane.org> <klbq25$osh$1@ger.gmane.org>
On Apr 25, 7:44pm, Yuri D'Elia wrote:
}
} On 04/25/2013 06:47 PM, Yuri D'Elia wrote:
} > 2) Why "precmd() { { print "HELLO" } >&- 2>&-; } doesn't suppress the
} > error in this case?
}
} Closest analogue I could find is:
}
} % { { print >&2 } 2>&- } 2>/dev/null
} zsh: write error
Of course what's happening here is in outside-in order. Starting with
the stuff you can mostly see:
1. stderr is redirected to /dev/null (old stderr is saved)
2. stderr is closed (at this point the outer redirection is gone)
3. print generates an error
Now the stuff you can't see happens:
4. zsh gets another error writing to the closed stderr
5. zsh warns about that to the saved stderr from step 1
You avoid the whole mess if you never close stderr, or if you close it
before step 1 (e.g. by "exec 2>&-"), though the latter is impractical
in the case we're discussing.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author