Sublime Forum

Build 4145 - BrokenPipeError

#1

After todays update our long-used phpfmt is no longer formating
the source-code on save … (or on command).
It shows :

Traceback (most recent call last):
File “C:\Program Files\Sublime Text 3\Lib\python33\sublime_plugin.py”, line 1494, in run_
return self.run(edit)
File “C:\Users\jgeig\AppData\Roaming\Sublime Text 3\Packages\phpfmt\phpfmt.py”, line 674, in run
src = dofmt(self, self.view, None, src, True)
File “C:\Users\jgeig\AppData\Roaming\Sublime Text 3\Packages\phpfmt\phpfmt.py”, line 155, in dofmt
p.stdin.write(src.encode(‘utf-8’))
BrokenPipeError: [Errno 32] Broken pipe

Any chance to get it back to work?

The dev-update was the only change between this issue.

0 Likes

#2

Does downgrading to the previous dev build (https://download.sublimetext.com/sublime_text_build_4141_x64_setup.exe) make it work again? Does it happen in safe mode?

0 Likes

#3

I can reproduce BrokenPipeError on ST 4146 while not happening on ST 4143.

I’d say it was working by luck.

phpfmt writes to stdin directly and than invokes communicate(). The latter function was introduced by python to avoid such kinds of race conditions causing pipes not beeing ready for communication.

Changing those lines to

            src = src.encode('utf-8')

        lint_out, lint_err = p.communicate(src)

fixes the issue as src is written by communicate() as soon as stdin is ready.

0 Likes

#4

ahh …
so this changes by the 4145 / 4146 upgrade would be also in future releases?
(only for my “programmer” interest … sideeffects etc … ) :slight_smile:

I downgraded yesterday to 4141 and it worked fine (for the #2 question) .

Thank you for looking into the phpfmt code and for the solution… Great.

0 Likes

#5

Whether this change in behavior is forever probably depends on the reasons causing them.

0 Likes

#6

This is likely the same issue as https://github.com/sublimehq/sublime_text/issues/5786

0 Likes

#7

Issue persists on ST 4147 which ships with a fix for #5786

0 Likes