Apache flex AIR NativeProcess执行此任务,但它会将进度数据发送到ProgressEvent.STANDARD\u ERROR\u数据
在Flex AIR应用程序中,我希望使用NativeProcess API和curl将文件上载到ftp服务器。Apache flex AIR NativeProcess执行此任务,但它会将进度数据发送到ProgressEvent.STANDARD\u ERROR\u数据,apache-flex,air,Apache Flex,Air,在Flex AIR应用程序中,我希望使用NativeProcess API和curl将文件上载到ftp服务器。 以下是简化代码: protected function startProcess(event:MouseEvent):void { var processInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo(); processInfo.executable = new File('/usr/bin/c
以下是简化代码:
protected function startProcess(event:MouseEvent):void
{
var processInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
processInfo.executable = new File('/usr/bin/curl');
var processArgs:Vector.<String> = new Vector.<String>();
processArgs.push("-T");
processArgs.push("/Users/UserName/Desktop/001.mov");
processArgs.push("ftp://domainIp//www/site.com/");
processArgs.push("--user");
processArgs.push("username:password");
processInfo.arguments = processArgs;
var process:NativeProcess = new NativeProcess();
process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, outputDataHandler);
process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, errorOutputDataHandler);
process.start(processInfo);
}
以下是后一个函数的输出:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
1 15.8M 0 0 1 200k 0 166k 0:01:37 0:00:01 0:01:36 177k
2 15.8M 0 0 2 381k 0 143k 0:01:53 0:00:02 0:01:51 146k
...
我的代码怎么了?如何调试它?谢谢。您看到的是curl的进度表。尝试使用
-sS
选项禁用它,但保留错误消息。这是因为curl将信息写入stderror以避免污染stdout。从stderror读取信息以向用户提供进度是否安全?
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
1 15.8M 0 0 1 200k 0 166k 0:01:37 0:00:01 0:01:36 177k
2 15.8M 0 0 2 381k 0 143k 0:01:53 0:00:02 0:01:51 146k
...