|
I have need to call a perl script from XPCom. I am doing it as follows: function exec(str_theProgram,theArgs,doIWait) { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); //program to start //example: str_theProgram = "/usr/X11R6/bin/xterm"; if (theArgs) { numArgs = theArgs.length; } else { theArgs = null; } var fid = "@mozilla.org/file/local;1"; var file = Components.classes[fid].createInstance(Components.interfaces.nsILocalFile); file.initWithPath(str_theProgram); //try to create process try { var pid = "@mozilla.org/process/util;1"; var theProcess = Components.classes[pid].createInstance(Components.interfaces.nsIProcess); theProcess.init(file); theProcess.run(doIWait, theArgs, numArgs, {}); } catch (e) { alert(e); } } I call the exec function from another script. When str_theProgram is just about anything other than a perl script, the function works as intended. It works for bash scripts (although everything in the script needs an absolute path). I have chmod 755'ed my perl scripts so that I can call them directly, and still nada. I noted another individual trying to do something similar: Jordi Llonch wrote: Hi, Definitely not ;) You want nsIProcess. But beware, using nsIProcess you can't set up pipes (stdin/stdout) to the process you are running. That requires some advanced coding, and I don't think you can do it without using the NSPR process API. --BDS The given advice makes me wary. Was there ever a solution to this problem? Does this advanced coding occur in _javascript_ or a C++ wrapper? What do I need to do to get this to happen. My current project is dead in the water until I can solve this issue. Thanks in advance. Tim Niiler _______________________________________________ Mozilla-xpcom mailing list [email protected] http://mail.mozilla.org/listinfo/mozilla-xpcom |
