Am I using proc:exec wrong?

Saturday, 3 September 2022 · 3 messages
GS
Graydon Saunders3 Sep 2022 02:17 #
Hello -- This is with BaseX 10.1 on a linux box: 18:02 graydon % java -version openjdk version "17.0.4" 2022-07-19 OpenJDK Runtime Environment (Red_Hat-17.0.4.0.8-1.fc36) (build 17.0.4+8) OpenJDK 64-Bit Server VM (Red_Hat-17.0.4.0.8-1.fc36) (build 17.0.4+8, mixed mode, sharing) I'm trying to invoke CoffeePot, https://coffeepot.nineml.org/ which is an ixml processor. In the BaseX GUI, proc:execute('/usr/bin/java','-version') gives me the expected version information as an error, despite a return code of zero: <result><error>openjdk version "17.0.4" 2022-07-19 OpenJDK Runtime Environment (Red_Hat-17.0.4.0.8-1.fc36) (build 17.0.4+8) OpenJDK 64-Bit Server VM (Red_Hat-17.0.4.0.8-1.fc36) (build 17.0.4+8, mixed mode, sharing) </error><code>0</code></result> From a console, /usr/bin/java -cp /home/graydon/bin/coffeepot-package/coffeepot-1.99.8/coffeepot-1.99.8.jar org.nineml.coffeepot.Main works fine, in as much as I get the list of coffeepot usage information I expect if it's run without arguments. proc:execute('/usr/bin/java','-cp /home/graydon/bin/coffeepot-package/coffeepot-1.99.8/coffeepot-1.99.8.jar org.nineml.coffeepot.Main') returns <result><error>Unrecognized option: -cp /home/graydon/bin/coffeepot-package/coffeepot-1.99.8/coffeepot-1.99.8.jar org.nineml.coffeepot.Main Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. </error><code>1</code></result> I suspect I'm doing something wrong, but it's not at all clear to me what. Anyone have suggestions? Thanks! Graydon
BD
Bridger Dyson-Smith3 Sep 2022 02:55 #
Hey Graydon - I'm on mobile and can't verify, but what about proc:execute($path-to-java, ('-cp', 'home/graydon/bin/coffeepot- package/coffeepot-1.99.8/coffeepot-1.99.8.jar', ' org.nineml.coffeepot.Main')) Multiple args need to be in a sequence, as I recall but I haven't had a chance to try this with v10.1. HTH! Bridger
Quoted text · Graydon Saunders · 51 lines
On Fri, Sep 2, 2022, 6:18 PM Graydon Saunders <graydonish at gmail.com> wrote: > Hello -- > > This is with BaseX 10.1 on a linux box: > 18:02 graydon % java -version > openjdk version "17.0.4" 2022-07-19 > OpenJDK Runtime Environment (Red_Hat-17.0.4.0.8-1.fc36) (build 17.0.4+8) > OpenJDK 64-Bit Server VM (Red_Hat-17.0.4.0.8-1.fc36) (build 17.0.4+8, > mixed mode, sharing) > > I'm trying to invoke CoffeePot, https://coffeepot.nineml.org/ which is an > ixml processor. > > In the BaseX GUI, > proc:execute('/usr/bin/java','-version') > > gives me the expected version information as an error, despite a return > code of zero: > <result><error>openjdk version "17.0.4" 2022-07-19 > OpenJDK Runtime Environment (Red_Hat-17.0.4.0.8-1.fc36) (build 17.0.4+8) > OpenJDK 64-Bit Server VM (Red_Hat-17.0.4.0.8-1.fc36) (build 17.0.4+8, > mixed mode, sharing) > </error><code>0</code></result> > > From a console, > /usr/bin/java -cp > /home/graydon/bin/coffeepot-package/coffeepot-1.99.8/coffeepot-1.99.8.jar > org.nineml.coffeepot.Main > > works fine, in as much as I get the list of coffeepot usage information I > expect if it's run without arguments. > > proc:execute('/usr/bin/java','-cp > /home/graydon/bin/coffeepot-package/coffeepot-1.99.8/coffeepot-1.99.8.jar > org.nineml.coffeepot.Main') > > returns > <result><error>Unrecognized option: -cp > /home/graydon/bin/coffeepot-package/coffeepot-1.99.8/coffeepot-1.99.8.jar > org.nineml.coffeepot.Main > Error: Could not create the Java Virtual Machine. > Error: A fatal exception has occurred. Program will exit. > </error><code>1</code></result> > > I suspect I'm doing something wrong, but it's not at all clear to me what. > > Anyone have suggestions? > > Thanks! > Graydon >
G
Graydon3 Sep 2022 03:22 #
Quoted text · Bridger Dyson-Smith · 2 lines
On Fri, Sep 02, 2022 at 06:55:36PM -0400, Bridger Dyson-Smith scripsit: > Hey Graydon -
Hi Bridger --
Quoted text · Bridger Dyson-Smith · 1 line
> I'm on mobile and can't verify, but what about
Your memory was correct!
Quoted text · Bridger Dyson-Smith · 2 lines
> Multiple args need to be in a sequence, as I recall but I haven't had a > chance to try this with v10.1.
They do. And I should have read "$args as xs:string*" that way. Sigh. But at least it runs!
-- Graydon Saunders | graydonish at gmail.com Þæs oferéode, ðisses swá mæg. -- Deor ("That passed, so may this.")

⚡Generated with XQuery