Skip to content

Commit

Permalink
fix delete in copy bug (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
yungezz authored Oct 1, 2018
1 parent 8b35ebe commit 97b0c7f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ All notable changes to the "vscode-ansible" extension will be documented in this
## 0.5.1
#### Bug fixing
- Fixing wrong configuration name. [PR 188](https://github.com/VSChina/vscode-ansible/pull/188)
- Workarond for scp not deleting folders/files existing on remote host only. [PR 190](https://github.com/VSChina/vscode-ansible/pull/190)

## 0.5.0
#### New features
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 7 additions & 14 deletions src/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,23 +257,16 @@ export function copyFilesRemote(source: string, dest: string, sshServer: SSHServ
reject(err);
});

conn.on('ready', () => {
if (fsExtra.lstatSync(source).isDirectory()) {
conn.exec("rm -fr " + dest, (error) => {
conn.end();
if (error) {
vscode.window.showErrorMessage('Failed to copy ' + source + ' to ' + sshServer.host + ': ' + error);
reject(error);
} else {
scpCopy(source, client, sshServer.host, reject, resolve);
}
});
conn.end();
scp.scp(source, client, (err) => {
if (err) {
vscode.window.showErrorMessage('Failed to copy ' + source + ' to ' + sshServer.host + ': ' + err);
return reject(err);
} else {
conn.end();
scpCopy(source, client, sshServer.host, reject, resolve);

return resolve();
}
});

} catch (err) {
reject('scp error: ' + err);
}
Expand Down

0 comments on commit 97b0c7f

Please sign in to comment.