Gio.subprocess broken pipe in flatpak app

I am trying to move an existing app to flatpak.
The app depends on curl which I have added as a module in the manifest.
When I run the part that depends on curl, I get a broken pipe error.
“Gio.IOErrorEnum: Error writing to file descriptor: Broken pipe”
The GJS code uses Gio.subrocess communicate_utf8_finish() where the error occurs.

Is there something preventing my app from reading stdout?

Code is here:

The error occurs in line 261 of the file src/object/Message.js in the send() function.

I’m happy to add extra information, but don’t know what would be useful, so don’t hesitate to ask…

Thanks in advance for any pointers.

Are you using GNOME Builder? If so can you try running a curl command in a runtime terminal?

I’m using codium…
Not sure how to get a runtime terminal.
The terminal that shows what’s going on during execution is read only.
Also, I get the same error whether or not I include curl as a module, so problem may be spawning a subprocess in general more than exactly what that subprocess is supposed to be.

OK, I got a runtime terminal and tested curl → could not resolve host, so dns problem? would that cause a broken pipe ?

Does your flatpak manifest open a sandbox hole for networking?

Yes --share=network is in finish-args

“Broken pipe” is a pretty generic error, that probably just means the process exited with an error. Which is I guess a DNS error.

It should hopefully not be necessary, but you can try adding --talk-name=org.freedesktop.Flatpak, which should allow curl to run on the host. If that doesn’t work, then it’s probably not Flatpak causing troubles.

No luck.
Adding flatpak to --talk didn’t solve the problem, but something else is indeed the issue.
The following works fine (in modules)

			"name": "test",
			"buildsystem": "simple",
			"build-commands": [

I can console log the subprocess and result object.

Could there be a permissions/access issue? Do I need to open a different hole in the sandbox to access stdin/stdout?

curl works at build time.
curl cannot connect to server ( from the sdk runtime terminal
curl cannot resolve hosts from the sdk runtime terminal

does --share=network apply to subprocesses also?

Problem solved:
added --socket=system-bus

Thanks for your time and effort :slight_smile:

1 Like

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.