Hi Simon, > wrapper for GObject-Introspection, like python3-gi. If you're writing > in Perl, libglib-object-introspection-perl seems to be the right library?
Actually, I am writing in Scala, so not what-so-ever introspection. I just want to call an external program to open a pdf or txt file. > be using GLib's GSubprocess or g_spawn_async(), or Python's subprocess > module - I'd recommend using the closest available equivalent of those > in your chosen language. Of course, this is a trival thing to spawn just another java thread and execute gio, but it doesn't answer the question why the program gio works differently on the command line or called from a program. > I'd be surprised if that's the cause of the difference you're seeing. > Are you sure the difference is in where you're calling it from, and not > some other factor like whether the PDF viewer was already running? No. I tried it several times. Both with Perl and Scala. In all cases when there are calls based on exec or system or similar, gio does not return immediately. My guess is that it checks for an attached tty. > Does the behaviour of `gio open` differ from what happens when you run > the configured PDF viewer directly? (To have an apples-to-apples comparison > you will need to make sure to be consistent about whether/when you kill > any background processes belonging to that viewer.) Yes and no: In the shell/prompt: $ evince foo.pdf does return after evince is closed $ gio foo.pdf does return *immediately* Called from Perl/Scala/whatever other prog language evince foo.pdf does return after evince is closed gio foo.pdf does return after goo -> evince is closed > If the invoked application backgrounds itself or does the "IPC to remote > instance, then exit" pattern, then there is nothing that `gio open` > can do to wait for completion, so waiting for completion seems like an > impossible behaviour to guarantee. No, that is wrong. gio open foo.pdf immediately returns to the prompt on an interactive shell, even when there is no other instance of the respective pdf viewer running. But called from a non-interactive shell/program, it returns only after the program has terminated. Norbert -- PREINING Norbert http://www.preining.info Accelia Inc. + JAIST + TeX Live + Debian Developer GPG: 0x860CDC13 fp: F7D8 A928 26E3 16A1 9FA0 ACF0 6CAC A448 860C DC13