5 Replies Latest reply on Aug 3, 2011 4:58 AM by socalfish

    AIR - Launching Native Process In Windows Not Working

    TheDarkIn1978 Level 1

      i'm attempting to launch a command line executable program as a background process in Windows 7, but it's not working. my AIR application is a native installer application: myAIRApp.exe.

       

      i've bundled myApp.exe with my AIR application, so that when it launches for the first time, the application copies myApp.exe to the applicationStorageDirectory (C:\Users\Administrator\AppData\Roaming\myAIRApp\ ). the copy is successful, but it refuses to launch on it's own. the copy is complete prior to trying to launch it. i doesn't show up as a running process in Task Manager and subsequently, my AIR application, which relies on myApp.exe to be running in the background, fails.

       

      if i manually double-click the copied myApp.exe in the applicationStorageDirectory it will open in Windows Command Processor, so the file is fine. the code also works fine on my Mac version, but instead of launching an .exe it launches the the Mac version as a background process, which opens in Terminal when manually launched.

       

      the process doesn't take any arguments and there is no requirement for my AIR application to directly communicate with the launched .exe background process. it only simply needs to be running.

       

      the AIR application is authored in Mac OS X, and i'm using Parallels Desktop to compile the Windows native installer using ADT and to test the application.

       

      any ideas why this might not be working?  any alternative suggestions?

       

       

      var myApp:File = File.applicationStorageDirectory.resolvePath("myApp.exe");
      var myAppProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
      myAppProcessStartupInfo
      .executable = myApp;

      myAppProcess
      = new NativeProcess();
      myAppProcess
      .start(myAppProcessStartupInfo);