fix: 增加权限相关helper说明

This commit is contained in:
xiaojunnuo
2024-04-08 10:05:11 +08:00
parent 836d18f07e
commit 4304c9443a
3 changed files with 13 additions and 14 deletions
+3 -4
View File
@@ -19,8 +19,8 @@ export class SshClient {
}
* @param options
*/
uploadFiles(options: { connectConf: any; transports: any; sudo: boolean }) {
const { connectConf, transports, sudo } = options;
uploadFiles(options: { connectConf: any; transports: any; }) {
const { connectConf, transports } = options;
const conn = new ssh2.Client();
return new Promise((resolve, reject) => {
@@ -35,8 +35,7 @@ export class SshClient {
try {
for (const transport of transports) {
this.logger.info("上传文件:", JSON.stringify(transport));
const sudoCmd = sudo ? "sudo" : "";
await this.exec({ connectConf, script: `${sudoCmd} mkdir -p ${path.dirname(transport.remotePath)} ` });
await this.exec({ connectConf, script: `mkdir -p ${path.dirname(transport.remotePath)} ` });
await this.fastPut({ sftp, ...transport });
}
resolve({});