gulp-rsync icon indicating copy to clipboard operation
gulp-rsync copied to clipboard

Failures aren't logged

Open deanmoses opened this issue 9 years ago • 21 comments

When the rsync fails, gulp-rsync doesn't log any errors in the terminal window.

Here's the task: gulp.task('deploy', function() { gulp.src('dist/**') .pipe(rsync({ root: 'dist', hostname: 'mydomain.com', destination: '~/mypath', recursive: true, progress: true // the transfer progress for each file will be displayed in the console })); });

Here's the output: $ gulp deploy [19:28:36] Starting 'deploy'... [19:28:36] Finished 'deploy' after 4.06 ms

It's probably failing because I'm not specifying login credentials / don't have a ssh key set up, but I can't tell because there's no logging.

deanmoses avatar Dec 04 '14 03:12 deanmoses

+1 for this.

haizaar avatar Dec 10 '14 16:12 haizaar

I'm trying like this

gulp.task('rsync', function() {
    if(!config.server) throw new Error("server not configured");
    return gulp.src(['**','!bower_components/**','!node_modules/**','!.**'])
        .pipe(plumber())
        .pipe(rsync({
            //root: '.',
            //incremental: true,
            progress: true,
            hostname: config.server,
            destination: '/usr/local/webenginex'
        }))
        .pipe(plumber.stop());
});

But all I get back is:

[14:54:24] Starting 'rsync'...
[14:54:31] gulp-rsync: Starting rsync to dev3:/usr/local/webenginex...

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn Unknown system errno 7
    at errnoException (child_process.js:1001:11)
    at Process.ChildProcess._handle.onexit (child_process.js:792:34)

I haven't the faintest clue what's wrong.

Some kind of logging would be really helpful.

mnpenner avatar Dec 11 '14 22:12 mnpenner

+1

doesnt work for me

born2net avatar Feb 22 '15 15:02 born2net

+1

chence avatar Mar 02 '15 04:03 chence

gulp-rsync is a shell to rsync. gulp-rsync will construct a rsync-command which is called upon. This command looks like:

rsync -rv --progress "dir1/file1" "dir1/file2" ... "dirN/fileN" "yourdest"

where the last value is your destination. gulp-rsync generates the destination path in the following manner:

username@hostname:yourpath

I have just submitted a longer PR #16 that also contains a new command-option to show the generated rsync-command. That does not give a logging, but a least one sees what is generated and can debug from there. Maybe that helps.

If you are impatient you can monkeypatch and just add one line of code to the source node-modules/gulp-rsync/index.js and get the generated rsync-command displayed:

Add

gutil.log(command);

into the if statement

if (!options.silent) {
   gutil.log('gulp-rsync:', 'Completed rsync.');
}

@deanmoses I believe your username is missing. @mnpenner My hunch is that there is something wrong with your destination path. I tried to simulate your setup on my machine, but I could not since I am running on Windows,

karland avatar Mar 03 '15 12:03 karland

I am trying to use this plugin, but it's failing silently and I can't determine the issue.

I am seeing the files queue up by setting a breakpoint (and have used the gulp-debug plugin to verify that my files are streaming in), but the flushFunction (i.e. the second parameter to the through.obj() call) isn't being called.

I'll just use node-rsync for now, but would be good to tie in with our gulp tasks.

jfrumar avatar Mar 09 '15 22:03 jfrumar

+1

born2net avatar Mar 09 '15 22:03 born2net

So... I just outputted the command it generates, and its a few thousand lines long. I'd give you an exact number, but my computer can't handle it.

The whole reason I'm using rsync is because I have a lot of files to transfer. Otherwise I'd use SCP.

I think I'm going to try using node-rsync like @jfrumar. If there's more than ~25 files or so, I'm just going to rsync the whole folder rather than generating a giant command.

mnpenner avatar Mar 17 '15 23:03 mnpenner

@mnpenner Hi, I did not recommend to output the command in general. It is more an idea for debugging or testing gulp-rsync in the individual context by actually seeing the command that is generated. For this purpose I would use only a small number of files and directories. Once the rsync-command is known, one can run just this rsync-command by itself and see the errormessages. When everything runs satisfactory I think there is no need to display the command any longer, especially not when there are many files.

karland avatar Mar 18 '15 10:03 karland

I added this in my options and now, not only does it actually attempt to deploy, it also throws an unhandled error message.

Addied this...

rsync({
      options: {
        'verbose': true
      },

Throws this...

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn Unknown system errno 7

krazyjakee avatar May 22 '15 09:05 krazyjakee

+1

samuelbeek avatar May 26 '15 10:05 samuelbeek

+1

jlouthan avatar Jun 12 '15 21:06 jlouthan

+1 get windows working right

born2net avatar Jun 12 '15 22:06 born2net

+1

szan avatar Jul 29 '15 11:07 szan

+1

kandros avatar Aug 04 '15 20:08 kandros

+1

abcdefe avatar Aug 11 '15 10:08 abcdefe

+1

tinayihe avatar Feb 25 '16 09:02 tinayihe

+1

capito-tar-gz avatar Jul 14 '16 17:07 capito-tar-gz

+1

Preen avatar Sep 27 '16 11:09 Preen

I did a rookie misstake on this. Instead of doing: gulp.task('deploy', function() { gulp.src('../privlic/*') .pipe(rsync({ root: '../privlic', username: 'deployer', hostname: 'IP', progress: true, destination: '/var/www/wp-content/themes/...' })); });

You need to return the gulp.src. Like this:

gulp.task('deploy', function() { return gulp.src('../privlic/*') .pipe(rsync({ root: '../privlic', username: 'deployer', hostname: 'IP', progress: true, destination: '/var/www/wp-content/themes/...' })); });

Preen avatar Sep 27 '16 11:09 Preen

@Preen ^^^ I'm doing the same thing. Did not work for me.

+1

sshaginyan avatar Oct 03 '16 02:10 sshaginyan