0
votes

I'm working on calling out to an external executable from the Adobe Air run time. The application is deployed as a native executable (.exe) from Air. Below is the code that I am using to generate the NativeProcess class and run the external call:

var file:File = File.applicationDirectory;
file = file.resolvePath("path to exe");

if(file.exists)
    {
        var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();

    nativeProcessStartupInfo.executable = file;

    var procArgs:Vector.<String> = new Vector.<String>();
    procArgs[0] = url;
    procArgs[1] = contentType;
    procArgs[2] = postData;

    nativeProcessStartupInfo.arguments = procArgs;

    _process = new NativeProcess();

    try
    {
            _process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);
            _process.addEventListener(ProgressEvent.STANDARD_INPUT_PROGRESS, onOutputData);
            _process.addEventListener(IOErrorEvent.STANDARD_OUTPUT_IO_ERROR, onIOError);
            _process.addEventListener(IOErrorEvent.STANDARD_ERROR_IO_ERROR, onIOError);

            trace("About to call external process");

            _process.start(nativeProcessStartupInfo);

            trace("Called external process");
     }

The only way I get the executable to launch is by using a break point and running the application in debug.

I have set the <supportProfiles> tag in the application xml to be desktop extendedDesktop to allow the call to a native process.

The compiler is also set to deploy the exe into the application's directory structure.

I'm really struggling to understand what I could have set somewhere to get this to only fire in debug mode but not under normal circumstances in order to launch the process. Any suggestions would be greatly appreciated!

1

1 Answers

0
votes

My issues were two fold, I had some debug code in the external executable that was not being handled by the Flex UI causing the call to fail. I also had made other configuration changes to stop the properly flags from being used. These were added to assist me in finding out what was causing the calls to fail and I didn't remove them once I fixed the original problem which was incorrect parameters being passed.