Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

Why does Shipit try to use rm command to delete file on windows? #278

Open
obriankevin11 opened this issue Oct 21, 2020 · 1 comment
Open

Comments

@obriankevin11
Copy link

IMO it should use del command. How can I change that?

Running "mkdir -p /var/www/<hidden>/releases/20201021130855" on host "<hidden>".
Release path created.
Copy project to remote servers.
"copy" method is deprecated, please use "copyToRemote", "copyFromRemote", "scpCopyToRemote" or "scpCopyFromRemote". It will break in v5.0.0.
Running "mkdir -p /var/www/<hidden>/releases/20201021130855" on host "<hidden>".
@<hidden>-err 'rm' is not recognized as an internal or external command,
@<hidden>-err operable program or batch file.
'deploy:update' errored after 5.69 s
Error: Command failed: cd C:\Users\<hidden>\AppData\Local\Temp && C: && rm tmp-33708lcvMxMo00Qtf.tar.gz
'rm' is not recognized as an internal or external command,
operable program or batch file.

    at ChildProcess.exithandler (child_process.js:294:12)
    at ChildProcess.emit (events.js:198:13)
    at maybeClose (internal/child_process.js:982:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
@jeanbmar
Copy link

jeanbmar commented Nov 27, 2020

Monkey patch for Windows users who don't want to install rsync:

  1. Add the following task:
shipit.blTask('fix-win', () => {
    shipit.pool.connections.forEach((connection) => {
        const { runLocally } = connection;
        connection.runLocally = function(cmd, options) {
            if(!cmd.startsWith('ssh')) {
                cmd = cmd.replace(/ rm /g, ' del /s /q ');
            }
            return runLocally.call(this, cmd, options);
        }
    });
});
  1. Make sure to apply patch when you call shipit env deploy
shipit.on('deploy', () => {
    return shipit.start(['fix-win']);
});

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants