-
Notifications
You must be signed in to change notification settings - Fork 111
jbide-23862: fix for spaces in path to oc binary #272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
[test] |
@bdshadow dare to add unit-tests please? |
String cmdLine = new StringBuilder(location).append(' ').append(buildArgs(Arrays.asList(options))).toString(); | ||
String[] args = StringUtils.split(cmdLine, " "); | ||
List<String> args = new ArrayList<String>(); | ||
args.add("oc"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont think that we should hard code the binary name. Can't we just take the last segment of the cmd-line?
new File(location).getName()
would have the same effect in a generic way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you mean location
, not cmdLine
. Yes, i think it's a good proposal. Will change it. Though anyway we hard code such things, for example:
Line 144 in 83f04c2
final StringBuilder argsBuilder = new StringBuilder("rsync "); |
quite incredible, but even with the fix, which looks fine, things wont work on MacOS:
|
@adietish yes, it's really strange. So now it works everywhere except MacOs |
@bdshadow great, invoking now works for port forwarding and rsync when launched from JBT.
The command that's built - and works fine on the cmd-line - is the following:
the arguments that are built are the following:
|
String[] args = StringUtils.split(cmdLine, " "); | ||
ProcessBuilder builder = new ProcessBuilder(args); | ||
List<String> args = new ArrayList<String>(); | ||
ProcessBuilder builder = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i believe, that for improved readability, we could have l161-l177 extracted to their own method
ProcessBuilder createProcessBuilder(String location, OpenShiftBinaryOption... options)
@adietish a strange comma is here in the middle:
|
@adietish fixed, check it out, please |
Evaluated for javaclient test up to dcb2df2 |
Java Client Test Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test-openshift-restclient-java/325/) (Base Commit: 645fbbf) |
[merge] |
[merge] |
deployed openshift-restclient-java 5.7.0-SNAPSHOT to repository.jboss.org |
@adietish @jeffmaury @robstryker, i've checked it on Fedora 25 and Windows 10.
Please, check it on MacOS and once again on Linux and Windows.