Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

unable to link or copy the ng command #111

Open
mckennapsean opened this issue Dec 3, 2017 · 3 comments
Open

unable to link or copy the ng command #111

mckennapsean opened this issue Dec 3, 2017 · 3 comments
Labels

Comments

@mckennapsean
Copy link

mckennapsean commented Dec 3, 2017

While discovering #110, I found out that linking the ng command to anything else fails to work.
e.g. sudo ln -s /usr/local/bin/ng /usr/local/bin/ng2

Running ng2 results in connect: Connection refused in the console instead of the help screen.

The same thing occurs on a hard copy or even moving the file.

Is this because the name is hard-coded into the source somehow? Anyways, it also makes command collisions even harder to reconcile.

@sbalabanov-zz
Copy link
Contributor

I do not recall any usages of hardcoded name anywhere. We probably won't have cycles anytime soon to investigate this; though, we are always open to accept a pull request with a fix :)

@welchwilmerck
Copy link

welchwilmerck commented Jul 12, 2018

It's a feature of the client. It treats any name for $0 other than ng as the name of the class to submit to the server. So, it interprets ng2 as ng ng2. See http://martiansoftware.com/nailgun/quickstart.html

If you don't have a server listening on the default endpoint, you get Connection refused.

With a server listening, you'll get:

$ ng2
Jul 12, 2018 1:03:54 PM com.martiansoftware.nailgun.NGSession run
INFO: Nail raised unhandled exception
java.lang.ClassNotFoundException: ng2
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:374)
	at com.martiansoftware.nailgun.NGSession.run(NGSession.java:225)

@mckennapsean
Copy link
Author

mckennapsean commented Aug 1, 2018

thanks for that explanation, @welchwilmerck ! that is actually pretty clearly in the code once I knew where to look :)

it is unfortunate that you can only remap ng if you use the classname you are trying to call. this feature seems less flexible than writing simple one-line scripts that you can name whatever you want.

is it really a necessary feature? 🤷‍♀️

anywho, I'd be happy to take a look at removing the "feature" if it is not necessary - but if there are no intentions to do so then feel free to close. (forking seems overkill for something so simple...)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants