I am trying to call an executable inside a working role
I tried different executables:
1-program1.exe (C code compiled with visual studio, target: Win32)
2-program2.exe (C
3-program3.exe (C code compiled with visual studio, target: win32, this is a dummy program it only creates a text file)
My goal is to run program1.exe.
Results:
1- no signs of success. It should generate some files for any successful run. No files were generated.
2- success. It creates the text file.
3- no signs of success. No file was generated.
So, I wanted to understand why program1.exe does not work, but could not find the reason. I realized that the problem is not specific to program1.exe. For any win32 application, this is problematic.
What is the reason for this?
Here is the part of the code that relates to calling an external application:
var localStorage = RoleEnvironment.GetLocalResource("WorkerLocalStorage");
String workingDir = localStorage.RootPath + @"job";
var appRoot = Path.Combine(Environment.GetEnvironmentVariable("RoleRoot")
+ @"\", @"approot");
String workingDir = localStorage.RootPath + @"job";
String cmdline = "command1 command2";
ProcessStartInfo startinfo = new ProcessStartInfo();
startinfo.CreateNoWindow = false;
startinfo.UseShellExecute = true;
startinfo.FileName = Path.Combine(appRoot, @"program1.exe");
startinfo.Arguments = cmdline;
startinfo.WorkingDirectory = workingDir;
Process exeProcess = Process.Start(startinfo);
exeProcess.WaitForExit();
program2.exe works like this, I have no problem loading the file in blob. I could not find the problem. Could it be related to passing command line arguments? Do I need to specify additional things for a C-encoded executable?
By the way, all tests are successful in the emulator (i.e. in the development environment)
source
share