sqweek / dialog

Simple cross-platform dialog API for go-lang
ISC License
515 stars 78 forks source link

Pipeline is Failing #62

Closed vinodsharmak closed 2 years ago

vinodsharmak commented 2 years ago

Build and test are working fine on windows machine but pipeline is failing on linux. Please suggest if there are any dependencies we have to download. Pipeline logs are

Unable to init server: Could not connect: Connection refused (cpaas.test:225111): Gtk-WARNING **: 14:34:32.673: cannot open display:

go: downloading github.com/sqweek/dialog v0.0.0-20211002065838-9a201b55ab91 ? bitbucket.org/gath3rio/cpaas-desktop-file-transfer/pkg/config [no test files] Unable to init server: Could not connect: Connection refused (cpaas.test:224311): Gtk-WARNING **: 14:31:47.868: cannot open display:

pkg-config --modversion gtk+-3.0 3.22.11

Thanks

sqweek commented 2 years ago

Your pipeline environment doesn’t have an X server running so cannot display any dialogs.

On 26 Nov 2021, at 23:11, vinodsharmak @.***> wrote:

 Build and test are working fine on windows machine but pipeline is failing on linux. Please suggest if there are any dependencies we have to download. Pipeline logs are

Unable to init server: Could not connect: Connection refused (cpaas.test:225111): Gtk-WARNING **: 14:34:32.673: cannot open display:

go: downloading github.com/sqweek/dialog v0.0.0-20211002065838-9a201b55ab91 ? bitbucket.org/gath3rio/cpaas-desktop-file-transfer/pkg/config [no test files] Unable to init server: Could not connect: Connection refused (cpaas.test:224311): Gtk-WARNING **: 14:31:47.868: cannot open display:

pkg-config --modversion gtk+-3.0 3.22.11

Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

lexxxel commented 2 years ago

@sqweek but this means, I can NOT run any unit test on my project because the import of dialog will trigger

 C.XInitThreads()
 C.gtk_init(nil, nil)

without any chance to disable that. I mean, what would you think about some kind of variable (like env variable) that is checked before triggering gtk_init?

sqweek commented 2 years ago

@lexxxel ok it is reasonable to avoid gtk exiting during go init() when run in a headless context. I've made a change to that effect, however dialog will still panic if the app tries to open any dialogs (I'm not really interested in adding complexity for graceful degradation in headless contexts; dialog is a graphics package first and foremost).

lexxxel commented 2 years ago

@sqweek I thought about it the same way, gtk init without crash, but if one calls and dialog function -> crash. Thank you for fixing this issue.