microsoft / team-explorer-everywhere

Team Explorer Everywhere Plugin for Eclipse
Other
300 stars 96 forks source link

\" (backSlash double quotes) is treating as a literal, when java process issues command to the the Linux TFS command line client #321

Open hssom opened 4 years ago

hssom commented 4 years ago

Hi,

In our java application, the java process is contructing command for linux TFS command line client, for a collection URL having space, by escaping double quotes around TFS collection URL as,

tf dir -login:username,Password! -collection:\"http://appserver:8080/tfs/default collection\" -recursive $/\"test spaceNew\"

The following is the error occured:

An argument error occurred: Option 'collection' requires a full URL as its value: no protocol: "http://appserver:8080/tfs/default Team Explorer Everywhere Command Line Client (version 14.134.0.201804261732)

Note: The same command issued to windows TFS command line client works.

So, it is observed that \" (backSlash double quotes) sequence is not escaping the double quotes, instead it is treating as a literal.

Please let me know, is there any solution for this. Thank you.

ForNeVeR commented 4 years ago

Rules for escaping are different depending on how are you calling the client.

On Linux, all the corresponding APIs have the list-styled syntax, so you're actually supposed to do an equivalent of

execute("tf", "dir", "-login:username,Password!", "-collection:http://appserver:8080/tfs/default collection", "-recursive $/test spaceNew");

(note the quote placement!)

On Windows, where the corresponding APIs are string-based (i.e. are taking a single strings instead of a list of strings), there's a standard command-line parsing convention, which will do the same transformation for you (e.g. your -collection:"http://appserver:8080/tfs/default collection" will became "-collection:http://appserver:8080/tfs/default collection" according to it). That's why it works for you on Windows, but not on Linux.