Take the 2-minute tour ×

I want to run an svn ls <path> command when I try it out I get an error stating

svn: '.' is not a working copy

which is the standard error you would get for trying to run the command without a path and in a directory that is not version controlled by SVN. But the thing is when I console.log my command before executing it it specifically states the full, valid, path to a remote SVN repository.

e.g., svn ls https://svn.example.com/this/is/a/valid/repo

If I copy and paste the log into my own bash it lists the directory just fine.

Here's the code I'm tyring to execute

function svnls (path) {
    var cp = require('child_process'),
        command = 'svn ls ' + path;

    console.log(command);  // -> svn ls https://svn.example.com/this/is/a/valid/repo
    cp.exec(command, function (err, stdout, stderr) {

Alternatively I've tried the more verbose method of spawning a bash instance:

function svnls (path) {
    var bash = require('child_process').spawn('bash');

    bash.stdout.on('data', function (data) {
        var buff = new Buffer(data),
            result = buff.toString('utf8');


    bash.stderr.on('data', function (data) {
        var buff = new Buffer(data),
            error = buff.toString('utf8');


    bash.on('exit', function (code) {

    bash.stdin.write('svn ls ' + path);

and it outputs the same error to console as well as the exit code (1).

Does anyone know why this is failing?

share|improve this question
You are only printing the stderr. What are the contents of stdout and err? –  Gates VP Aug 23 '12 at 20:09
Nothing useful. err is just an object that states the same thing as stderr (and it exited with code 1) and stdout is blank. –  JaredMcAteer Aug 23 '12 at 20:16
Your code works fine for me. Node 0.8.7. –  Vadim Baryshev Aug 23 '12 at 20:40
I'm running 0.9.1-pre, I will try and downgrade to a stable version. –  JaredMcAteer Aug 23 '12 at 20:47
Stable version would be a good idea. Also, is it possible you have an issue with one of the options fields, like current working directory? –  Gates VP Aug 23 '12 at 20:54
show 1 more comment

Your Answer



Browse other questions tagged or ask your own question.