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
svn: Can't open file '.svn/entries': No such file or directory
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) {
console.log(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');
console.log(result);
});
bash.stderr.on('data', function (data) {
var buff = new Buffer(data),
error = buff.toString('utf8');
console.log(error);
});
bash.on('exit', function (code) {
console.log(code);
});
bash.stdin.write('svn ls ' + path);
bash.stdin.end();
}
and it outputs the same error to console as well as the exit code (1).
Does anyone know why this is failing?