mirror of https://github.com/certd/certd
fixed #73
parent
d46dab4fdd
commit
22ebcd4dd1
|
@ -77,7 +77,7 @@ export class AsyncSsh2Client {
|
||||||
reject(err);
|
reject(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let data: string = null;
|
let data: string = '';
|
||||||
stream
|
stream
|
||||||
.on('close', (code: any, signal: any) => {
|
.on('close', (code: any, signal: any) => {
|
||||||
this.logger.info(`[${this.connConf.host}][close]:code:${code}`);
|
this.logger.info(`[${this.connConf.host}][close]:code:${code}`);
|
||||||
|
@ -88,12 +88,14 @@ export class AsyncSsh2Client {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.on('data', (ret: Buffer) => {
|
.on('data', (ret: Buffer) => {
|
||||||
data = this.convert(ret)
|
const out = this.convert(ret)
|
||||||
this.logger.info(`[${this.connConf.host}][info]: ` + data);
|
data += out
|
||||||
|
this.logger.info(`[${this.connConf.host}][info]: ` + out.trimEnd());
|
||||||
})
|
})
|
||||||
.stderr.on('data', (ret:Buffer) => {
|
.stderr.on('data', (ret:Buffer) => {
|
||||||
data = this.convert(ret)
|
const err = this.convert(ret)
|
||||||
this.logger.info(`[${this.connConf.host}][error]: ` + data);
|
data += err
|
||||||
|
this.logger.info(`[${this.connConf.host}][error]: ` + err.trimEnd());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -167,7 +169,12 @@ export class SshClient {
|
||||||
this.logger.info("请注意:windows下,文件目录分隔应该写成\\而不是/")
|
this.logger.info("请注意:windows下,文件目录分隔应该写成\\而不是/")
|
||||||
this.logger.info("--------------------------")
|
this.logger.info("--------------------------")
|
||||||
}
|
}
|
||||||
mkdirCmd = `if not exist "${filePath}" mkdir ${filePath} `
|
const spec = await conn.exec(`echo %COMSPEC%`);
|
||||||
|
if (spec.toString().trim() === '%COMSPEC%') {
|
||||||
|
mkdirCmd = `New-Item -ItemType Directory -Path "${filePath}" -Force`;
|
||||||
|
} else {
|
||||||
|
mkdirCmd = `if not exist "${filePath}" mkdir "${filePath}"`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
await conn.exec(mkdirCmd);
|
await conn.exec(mkdirCmd);
|
||||||
await conn.fastPut({ sftp, ...transport });
|
await conn.fastPut({ sftp, ...transport });
|
||||||
|
|
Loading…
Reference in New Issue