Why does nailgun cache command line arguments?

▼魔方 西西 提交于 2019-12-24 02:18:13

问题


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$ 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']

回答1:


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.



来源:https://stackoverflow.com/questions/6350976/why-does-nailgun-cache-command-line-arguments

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!