mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
chgserver: deal with fdopen EINVAL case
Summary: The use of `fdopen` was to change the buffer size. It's not fatal if buffer size cannot be changed. This fixes a crash in `nohup hg root`. Reviewed By: aditya7fb Differential Revision: D17628883 fbshipit-source-id: 58f75e8e99fbe4cea8da2e3b48a092ee1331db6f
This commit is contained in:
parent
6cb28d027c
commit
7f3b4d93e9
@ -218,7 +218,12 @@ class chgcmdserver(commandserver.server):
|
||||
bufsize = 1 # line buffered
|
||||
else:
|
||||
bufsize = -1 # system default
|
||||
newfp = util.fdopen(fp.fileno(), mode, bufsize)
|
||||
try:
|
||||
newfp = util.fdopen(fp.fileno(), mode, bufsize)
|
||||
except OSError:
|
||||
# fdopen can fail with EINVAL. For example, run
|
||||
# with nohup. Do not set buffer size in that case.
|
||||
newfp = fp
|
||||
setattr(ui, fn, newfp)
|
||||
setattr(self, cn, newfp)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user