开发者

Why does nailgun cache command line arguments?

开发者 https://www.devze.com 2023-03-13 12:23 出处:网络
When running Jython programs through nailgun the jython program always runs with the command line arguments of the first time it was run.

When running Jython programs through nailgun the jython program always runs with the command line arguments of the first time it was run.

first I start nailgun:

arthur@a:~/nailgun$ 开发者_C百科java -jar nailgun.jar 
NGServer started on all interfaces, port 2113.

then when I run a simple jython script:

import sys

print sys.argv

then add jython to nailguns classpath

./ng ng-cp /usr/share/java/jython.jar 

then run the script with the word "first" as an arguemnt:

arthur@a:~/nailgun$ ./ng org.python.util.jython tmp.jy first
*sys-package-mgr*: can't create package cache dir, '/usr/share/java/jython.jar/cachedir/packages'
['tmp.jy', 'first']

run it again with the word "second" as an argument, and it prints "first"

arthur@a:~/nailgun$ ./ng org.python.util.jython tmp.jy second
['tmp.jy', 'first']

and always prints "first" from then on:

arthur@a:~/nailgun$ ./ng org.python.util.jython tmp.jy third
['tmp.jy', 'first']


nailgun author here.

Nailgun doesn't cache command line arguments by design, but singletons and other static variables will survive between invocations.

I'm not a python guy, but the "sys.argv" usage sure looks like a singleton to me. I'd suggest looking into jython's command line argument handling to see why it's not getting updated.

If you do this please post what you find... it might be something in nailgun but it's not something I've ever seen in several years of use.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号