node-rsync
node-rsync copied to clipboard
kill does not work
Rsync = require('rsync');
cmd = new Rsync()
.flags('avz')
.source('src/')
.destination('dst/');
c = cmd.execute(
function(error,code,cmd) { console.log("Done"); },
function(data) { console.log(data.toString()); },
function(data) { console.log(data.toString()); },
);
setTimeout(function() {
console.log("!!!!!!!Killing!!!!!!");
c.kill();
},4000);
Should kill the sync after 4 seconds. It does not. rsync does seem to receive the signal.
This seems to be debian only issue. But still it does not work as expected.
On Debian, /bin/sh is linked to dash. Dash doesn't seem to support job control...the solution is to set the shell to /bin/bash:
var sync = new rsync()
.executableShell('/bin/bash')
.source(sourcepath)
.destination(destpath);
Just wondering, why are you using a shell instead of just calling rsync?
cmdProc = spawn(this.executable(), this.args(),
{ stdio: 'pipe', cwd: this._cwd, env: this._env });
seems to pass all test and work correctly on linux.