Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

When I use rsync in winows system, there is an unsolvable error #68

Open
@sfyr111

Description

@sfyr111

env:
process.platform: win32
node version: v10.x.x

my code

const workDir = path.resolve('.')


console.log(chalk.red(`This platform is ${process.platform}\n`))

const stdoutHandler = function(data) {
	console.log(chalk.green('stdoutHandler: '))
	console.log(data.toString())
	console.log(chalk.green('================\n'))
}
const stderrHandler = function() {
	console.log(chalk.red('stderrHandler: '))
	console.log(data.toString())
	console.log(chalk.red('================\n'))
}

module.exports = async (txt) => {
	
	const outFile = path.resolve(workDir, `testSync.txt`)
	await fse.outputFile(outFile, txt)
	
	const cmd = new Rsync()
		.flags('avz')
		.shell('ssh')
		.source(outFile)
		.destination('name@server:/home/appadmin/cli');
	
	cmd.execute(function(error, code, cmd) {
		console.log('code: ', code)
		if (error) {
			console.error(error)
			console.log('error: ', cmd)
			process.exit(1)
		}
		console.log('All done executing: ', cmd);
	}, stdoutHandler, stderrHandler);
}

cmd output content:

$ retailo2o-cli test 000
This platform is win32

stdoutHandler:
'rsync' �����ڲ����ⲿ���Ҳ���ǿ����еij���
���������ļ���

================

code:  1
Error: rsync exited with code 1
    at Rsync.<anonymous> (D:\nvm\v10.15.1\node_global\node_modules\retailo2o-cli\node_modules\rsync\rsync.js:525:21)
    at ChildProcess.emit (events.js:189:13)
    at maybeClose (internal/child_process.js:970:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
error:  rsync -avz --rsh=ssh /workspace/coupon/testSync.txt name@server:/home/appadmin/cli

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions