get_path_to_default_node.sh output includes trailing characters that break node path resolution on some systems
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.3k
- Forks
- 752
- Avg merge
- 6d 21h
- Merged PRs (30d)
- 8
Description
Description
The included get_path_to_default_node.sh script output may contain extra trailing characters that prevent the library from being able to determine the node path on Linux, depending on the environment that it is executed in. This results in an error code about there not being any node installed on the system: No installed nodes!
Environment
I think this is the relevant part of the environment from what I can tell.
- Ubuntu 16.04 (MATE)
- IntelliJ 2017.3
Details
I have a pretty full write up on stack overflow here: https://unix.stackexchange.com/questions/402582/script-output-has-mysterious-trailing-characters-when-executed-in-a-specific-env
Please let me know if you want me to copy/pastes it into this issue.
Code To Reproduce Issue [ Good To Have ]
There is no code. You just need to execute the script in a particular environment on Linux. I'm still trying to figure out what it is exactly about my environment that makes this happen, but this is the output that I was getting from the get_path_to_default_node.shscript.
/home/me/node-v8.9.0-linux-x64/lib/node_modules
[H[2J
This is the line that it happens on in the Java library: https://github.com/appium/java-client/blob/ec9f586934b9c4931b43dd429b7aea1133d3a73b/src/main/java/io/appium/java_client/service/local/AppiumServiceBuilder.java#L142
Then, later on, when it attempts to call trim() on that string, because the last characters aren't technically, whitespace it doesn't do anything. So when it gets to this line it thinks the path doesn't exist because it isn't a valid file path.
Potential solution
This only happens for me when I launch IntelliJ from my desktop's launcher. If I run IntelliJ from a terminal it doesn't happen. Its definitely related to my environment in some way. But it only happens because we're executing a shell script. Instead, if it were a process started by Java, this sort of thing may not happen. Is there a reason that the script is being executed using a shell? Why not just execute npm directly and get the output instead of using bash and echo inside of Java?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with get_path_to_default_node.sh and the referenced AppiumServiceBuilder.java lines 142 and 154. Reproduce the script from an IntelliJ desktop launch versus a terminal on Linux, then verify that its output contains no trailing control characters and that the resulting Node path resolves successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, node.js, shell
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100