Note that there are some explanatory texts on larger screens.

plurals
  1. POAIR NativeProcess does the job, but it sends progress data to ProgressEvent.STANDARD_ERROR_DATA
    text
    copied!<p>In Flex AIR application, I would like to upload file to ftp-server with NativeProcess API and curl.<br> Here is the simplified code:</p> <pre><code>protected function startProcess(event:MouseEvent):void { var processInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo(); processInfo.executable = new File('/usr/bin/curl'); var processArgs:Vector.&lt;String&gt; = new Vector.&lt;String&gt;(); 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); } </code></pre> <p>It does the job well (i.e. target file is uploaded), but it emits <code>ProgressEvent.STANDARD_ERROR_DATA</code> instead of <code>ProgressEvent.STANDARD_OUTPUT_DATA</code> and all progress data goes to <code>process.standardError</code>.</p> <pre><code>protected function errorOutputDataHandler(event:ProgressEvent):void { var process = event.currentTarget as NativeProcess; trace(process.standardError.readUTFBytes(process.standardError.bytesAvailable)); } </code></pre> <p>Here is an output of the latter function:</p> <pre><code>% 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 ... </code></pre> <p>What's wrong with my code? How can I debug it?<br> Thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload