[Project_owners] Access to Terminal

Jesper Staun Hansen jesper at selvet.dk
Sun Jan 27 04:11:16 PST 2008


that was one tricky question. Used some time to find you an answer. This 
will probably be my best guess:
http://developer.mozilla.org/en/docs/Code_snippets:Running_applications

The way they run it is (look in components/flashgotService.js):
runNative: function(args, blocking, exeFile) {
    try {
      if (typeof(exeFile)=="object"
        || (exeFile = this.exeFile).exists()
        || this.createExecutable()) {
        const proc=CC['@mozilla.org/process/util;1'].createInstance(
          CI.nsIProcess);
        proc.init(exeFile);
        this.log("Running " + exeFile.path + " " + args.join(" ") + " -- 
" +(blocking ? "blocking" : "async") );
        proc.run(blocking,args,args.length,{});
        if (blocking && proc.exitValue != 0) {
          this.log("Warning: native invocation of\n"
            +exeFile.path
            +"\nwith arguments <"
            +args.join(" ")
            +">\nreturned "+proc.exitValue);
        }
        return proc.exitValue;
      } else {
        this.log("Bad executable "+exeFile);
      }
    } catch(err) {
      this.log("Error running native executable:\n" + exeFile.path + 
        " "+args.join(" ")+"\n"+err.message);
    }  
    return 0xffffffff;
  }


joe ertaba wrote:
> Hi,
>
> how can I access to *linux terminal* from "@mozilla.org/process/util;1 
> <http://mozilla.org/process/util;1>"
>
> I want to send some commands to terminal from my extension, some thing 
> like run wget to get files ,...
>
> PS: recently Flashgot runs Wget in terminal window
> ------------------------------------------------------------------------
>
> _______________________________________________
> Project_owners mailing list
> Project_owners at mozdev.org
> https://www.mozdev.org/mailman/listinfo/project_owners
>   




More information about the Project_owners mailing list