0

I'm using the svn command from Java to get info about a working copy.

final Process exec = Runtime.getRuntime().exec(
    new String[]{"svn","info","--xml","/path/to/wc"}
);
ByteStreams.copy(exec.getErrorStream(), System.err);
// ... more code to read output

This gives the error output

/path/to/wc
:  (Not a versioned resource)

However, if I run the same command in a terminal window, I get the output I want. I also tried to rule out the environment when running in a terminal:

env -i svn info --xml /path/to/wc

But the output is still correct. Why does it behave differently when run from Java?

Bart van Heukelom
  • 43,244
  • 59
  • 186
  • 301

1 Answers1

1

The real /path/to/wc had a newline at the end of it. If I were more familiar with SVN error output, I could have seen it:

/path/to/wc
:  (Not a versioned resource)

Note the newline before the :

I accidentally found this by replacing an earlier exec("readlink -m " + path) by the pure Java path.getCanonicalName().

Bart van Heukelom
  • 43,244
  • 59
  • 186
  • 301