From PAWANthethunder at gmail.com Sun Apr 5 00:41:56 2009 From: PAWANthethunder at gmail.com (pawan_sin99) Date: Sun, 5 Apr 2009 00:41:56 -0700 (PDT) Subject: [Jslib] Executing unix command ( such as ls ) from the jslib Message-ID: <22891225.post@talk.nabble.com> Hi, I am developing an extension which will run unix command of shell such as ls..and fetch the ls result and displays it on addon...I am not getting how to do it with jslib. Thanks in advance, Pawan Kumar -- View this message in context: http://www.nabble.com/Executing-unix-command-%28-such-as-ls-%29-from-the-jslib-tp22891225p22891225.html Sent from the MozDev - jslib mailing list archive at Nabble.com. From pete at mozdevgroup.com Sun Apr 5 08:39:40 2009 From: pete at mozdevgroup.com (Pete Collins) Date: Sun, 05 Apr 2009 09:39:40 -0600 Subject: [Jslib] Executing unix command ( such as ls ) from the jslib In-Reply-To: <22891225.post@talk.nabble.com> References: <22891225.post@talk.nabble.com> Message-ID: <49D8D0BC.2050902@mozdevgroup.com> nsIProcess only supports executing commands and not returning stdout back to the caller ... --pete pawan_sin99 wrote: > Hi, I am developing an extension which will run unix command of shell such as > ls..and fetch the ls result and displays it on addon...I am not getting how > to do it with jslib. > > > Thanks in advance, > Pawan Kumar > -- Pete Collins - Founder, Mozdev Group Inc. www.mozdevgroup.com Mozilla Software Development Solutions tel: 1-719-302-5811 fax: 1-719-302-5813 From PAWANthethunder at gmail.com Sun Apr 5 09:17:37 2009 From: PAWANthethunder at gmail.com (pawan_sin99) Date: Sun, 5 Apr 2009 09:17:37 -0700 (PDT) Subject: [Jslib] Executing unix command ( such as ls ) from the jslib In-Reply-To: <49D8D0BC.2050902@mozdevgroup.com> References: <22891225.post@talk.nabble.com> <49D8D0BC.2050902@mozdevgroup.com> Message-ID: <22895561.post@talk.nabble.com> So, how can we get the stdout ..because I have to display results...Is there anyway to do it........... Pete Collins wrote: > > nsIProcess only supports executing commands and not returning stdout > back to the caller ... > > --pete > > pawan_sin99 wrote: >> Hi, I am developing an extension which will run unix command of shell >> such as >> ls..and fetch the ls result and displays it on addon...I am not getting >> how >> to do it with jslib. >> >> >> Thanks in advance, >> Pawan Kumar >> > > -- > Pete Collins - Founder, Mozdev Group Inc. > www.mozdevgroup.com > Mozilla Software Development Solutions > tel: 1-719-302-5811 > fax: 1-719-302-5813 > > _______________________________________________ > Jslib mailing list > Jslib at mozdev.org > https://www.mozdev.org/mailman/listinfo/jslib > > -- View this message in context: http://www.nabble.com/Executing-unix-command-%28-such-as-ls-%29-from-the-jslib-tp22891225p22895561.html Sent from the MozDev - jslib mailing list archive at Nabble.com. From pete at mozdevgroup.com Sun Apr 5 11:41:41 2009 From: pete at mozdevgroup.com (Pete Collins) Date: Sun, 05 Apr 2009 12:41:41 -0600 Subject: [Jslib] Executing unix command ( such as ls ) from the jslib In-Reply-To: <22895561.post@talk.nabble.com> References: <22891225.post@talk.nabble.com> <49D8D0BC.2050902@mozdevgroup.com> <22895561.post@talk.nabble.com> Message-ID: <49D8FB65.6040704@mozdevgroup.com> pawan_sin99 wrote: > So, how can we get the stdout ..because I have to display results...Is there > anyway to do it........... Mozilla doesn't currently support IPC. See this bug: https://bugzilla.mozilla.org/show_bug.cgi?id=68702 --pete -- Pete Collins - Founder, Mozdev Group Inc. www.mozdevgroup.com Mozilla Software Development Solutions tel: 1-719-302-5811 fax: 1-719-302-5813 From PLeugner at as-computer.de Sun Apr 5 13:13:44 2009 From: PLeugner at as-computer.de (Peter Leugner) Date: Sun, 5 Apr 2009 22:13:44 +0200 Subject: [Jslib] Antwort: Re: Executing unix command ( such as ls ) from the jslib In-Reply-To: <22895561.post@talk.nabble.com> References: <22891225.post@talk.nabble.com> <49D8D0BC.2050902@mozdevgroup.com> <22895561.post@talk.nabble.com> Message-ID: You can start a local server that's listening to a socket and redirect stdout to that socket with the help of netcat Example: var listener = { onStopListening: function() {}, onSocketAccepted: function(server, transport) { try { var stream = transport.openInputStream(0,0,0); var instream = Components.classes ["@mozilla.org/scriptableinputstream;1"].createInstance (Components.interfaces.nsIScriptableInputStream); instream.init(stream); } catch (e) { alert("Error "+e); } var dataListener = { data:"", onStartRequest: function(request, context) { this.data=""; }, onStopRequest: function(request, context, status) { instream.close(); // this.data has the sent data }, onDataAvailable: function(request, context, inputStream, offset, count) { this.data = this.data + instream.read(count); } }; var pump = Components.classes ["@mozilla.org/network/input-stream-pump;1"].createInstance (Components.interfaces.nsIInputStreamPump); pump.init(stream, -1, -1, 0, 0, false); pump.asyncRead(dataListener,null); } }; function startServer() { try{ var socket = Components.classes ["@mozilla.org/network/server-socket;1"]; server = socket.createInstance(); server = server.QueryInterface(Components.interfaces.nsIServerSocket); server.init(6669,true,-1); server.asyncListen(listener); } catch (e){ alert("Error: "+e); } } function stopServer() { if (server) server.close(); } Start the server and then start the script piping the output like ls | nc localhost 6669 Good luck, Peter Leugner --------------------------------------------------------------------- Leiter IT Anwendungsentwicklung Tel.: +49 (0) 89 45 06 63 26 Fax: +49 (0) 89 45 06 63 81 e-Mail: pleugner at as-computer.de Web: www.as-computer.de AS Computer Consulting & Service GmbH Sitz: M?nchen Gesch?ftsf?hrer: Dipl.-Ing. (FH) Andreas Erhart Register: M?nchen HRB 111 507 |------------> | Von: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |pawan_sin99 | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | An: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |jslib at mozdev.org | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | Datum: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |04/05/2009 20:39 | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | Betreff: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |Re: [Jslib] Executing unix command ( such as ls ) from the jslib | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | Gesendet | | von: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |jslib-bounces at mozdev.org | >--------------------------------------------------------------------------------------------------------------------------------------------------| So, how can we get the stdout ..because I have to display results...Is there anyway to do it........... Pete Collins wrote: > > nsIProcess only supports executing commands and not returning stdout > back to the caller ... > > --pete > > pawan_sin99 wrote: >> Hi, I am developing an extension which will run unix command of shell >> such as >> ls..and fetch the ls result and displays it on addon...I am not getting >> how >> to do it with jslib. >> >> >> Thanks in advance, >> Pawan Kumar >> > > -- > Pete Collins - Founder, Mozdev Group Inc. > www.mozdevgroup.com > Mozilla Software Development Solutions > tel: 1-719-302-5811 > fax: 1-719-302-5813 > > _______________________________________________ > Jslib mailing list > Jslib at mozdev.org > https://www.mozdev.org/mailman/listinfo/jslib > > -- View this message in context: http://www.nabble.com/Executing-unix-command-%28-such-as-ls-%29-from-the-jslib-tp22891225p22895561.html Sent from the MozDev - jslib mailing list archive at Nabble.com. _______________________________________________ Jslib mailing list Jslib at mozdev.org https://www.mozdev.org/mailman/listinfo/jslib !DSPAM:3,49d8fac747199060010485! -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: graycol.gif Type: image/gif Size: 105 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ecblank.gif Type: image/gif Size: 45 bytes Desc: not available URL: From PAWANthethunder at gmail.com Tue Apr 7 00:40:10 2009 From: PAWANthethunder at gmail.com (pawan_sin99) Date: Tue, 7 Apr 2009 00:40:10 -0700 (PDT) Subject: [Jslib] Antwort: Re: Executing unix command ( such as ls ) from the jslib In-Reply-To: References: <22891225.post@talk.nabble.com> <49D8D0BC.2050902@mozdevgroup.com> <22895561.post@talk.nabble.com> Message-ID: <22922693.post@talk.nabble.com> Thanks it worked...!!! Peter Leugner wrote: > > > You can start a local server that's listening to a socket and redirect > stdout to that socket with the help of netcat > > Example: > > var listener = { > onStopListening: function() {}, > onSocketAccepted: function(server, transport) { > > try { > var stream = transport.openInputStream(0,0,0); > var instream = Components.classes > ["@mozilla.org/scriptableinputstream;1"].createInstance > (Components.interfaces.nsIScriptableInputStream); > instream.init(stream); > } catch (e) { > alert("Error "+e); > } > > var dataListener = { > data:"", > > onStartRequest: function(request, context) { > this.data=""; > }, > > onStopRequest: function(request, context, status) { > instream.close(); > // this.data has the sent data > }, > > onDataAvailable: function(request, context, inputStream, offset, > count) { > this.data = this.data + instream.read(count); > } > }; > > var pump = Components.classes > ["@mozilla.org/network/input-stream-pump;1"].createInstance > (Components.interfaces.nsIInputStreamPump); > pump.init(stream, -1, -1, 0, 0, false); > pump.asyncRead(dataListener,null); > } > }; > > function startServer() { > > try{ > var socket = Components.classes > ["@mozilla.org/network/server-socket;1"]; > server = socket.createInstance(); > server = server.QueryInterface(Components.interfaces.nsIServerSocket); > > server.init(6669,true,-1); > server.asyncListen(listener); > } > catch (e){ > alert("Error: "+e); > } > > } > > function stopServer() { > if (server) server.close(); > } > > > Start the server and then start the script piping the output like > > ls | nc localhost 6669 > > Good luck, > > Peter Leugner > --------------------------------------------------------------------- > Leiter IT Anwendungsentwicklung > Tel.: +49 (0) 89 45 06 63 26 > Fax: +49 (0) 89 45 06 63 81 > e-Mail: pleugner at as-computer.de > Web: www.as-computer.de > > AS Computer Consulting & Service GmbH > Sitz: M?nchen > Gesch?ftsf?hrer: Dipl.-Ing. (FH) Andreas Erhart > Register: M?nchen HRB 111 507 > > > |------------> > | Von: | > |------------> > > >--------------------------------------------------------------------------------------------------------------------------------------------------| > |pawan_sin99 > | > > >--------------------------------------------------------------------------------------------------------------------------------------------------| > |------------> > | An: | > |------------> > > >--------------------------------------------------------------------------------------------------------------------------------------------------| > |jslib at mozdev.org > | > > >--------------------------------------------------------------------------------------------------------------------------------------------------| > |------------> > | Datum: | > |------------> > > >--------------------------------------------------------------------------------------------------------------------------------------------------| > |04/05/2009 20:39 > | > > >--------------------------------------------------------------------------------------------------------------------------------------------------| > |------------> > | Betreff: | > |------------> > > >--------------------------------------------------------------------------------------------------------------------------------------------------| > |Re: [Jslib] Executing unix command ( such as ls ) from the jslib > | > > >--------------------------------------------------------------------------------------------------------------------------------------------------| > |------------> > | Gesendet | > | von: | > |------------> > > >--------------------------------------------------------------------------------------------------------------------------------------------------| > |jslib-bounces at mozdev.org > | > > >--------------------------------------------------------------------------------------------------------------------------------------------------| > > > > > > > So, how can we get the stdout ..because I have to display results...Is > there > anyway to do it........... > > > > > Pete Collins wrote: >> >> nsIProcess only supports executing commands and not returning stdout >> back to the caller ... >> >> --pete >> >> pawan_sin99 wrote: >>> Hi, I am developing an extension which will run unix command of shell >>> such as >>> ls..and fetch the ls result and displays it on addon...I am not getting >>> how >>> to do it with jslib. >>> >>> >>> Thanks in advance, >>> Pawan Kumar >>> >> >> -- >> Pete Collins - Founder, Mozdev Group Inc. >> www.mozdevgroup.com >> Mozilla Software Development Solutions >> tel: 1-719-302-5811 >> fax: 1-719-302-5813 >> >> _______________________________________________ >> Jslib mailing list >> Jslib at mozdev.org >> https://www.mozdev.org/mailman/listinfo/jslib >> >> > > -- > View this message in context: > http://www.nabble.com/Executing-unix-command-%28-such-as-ls-%29-from-the-jslib-tp22891225p22895561.html > > Sent from the MozDev - jslib mailing list archive at Nabble.com. > > _______________________________________________ > Jslib mailing list > Jslib at mozdev.org > https://www.mozdev.org/mailman/listinfo/jslib > > !DSPAM:3,49d8fac747199060010485! > > > > > _______________________________________________ > Jslib mailing list > Jslib at mozdev.org > https://www.mozdev.org/mailman/listinfo/jslib > > -- View this message in context: http://www.nabble.com/Executing-unix-command-%28-such-as-ls-%29-from-the-jslib-tp22891225p22922693.html Sent from the MozDev - jslib mailing list archive at Nabble.com. From PAWANthethunder at gmail.com Wed Apr 8 04:47:22 2009 From: PAWANthethunder at gmail.com (pawan_sin99) Date: Wed, 8 Apr 2009 04:47:22 -0700 (PDT) Subject: [Jslib] Antwort: Re: Executing unix command ( such as ls ) from the jslib In-Reply-To: <22922693.post@talk.nabble.com> References: <22891225.post@talk.nabble.com> <49D8D0BC.2050902@mozdevgroup.com> <22895561.post@talk.nabble.com> <22922693.post@talk.nabble.com> Message-ID: <22948660.post@talk.nabble.com> I started sever its working fine...with command line... Now I made a c program which do system(ls | nc localhost 6669); The above statement is working fine... But when I do, system( ls | myprog | nc localhost 6669) ; myprog is in the bash file PATH of my shell....but here the system command does not find myprog path......means it is not including the PATH of the bash of shell...So After lot of search also I cannot able to debug this error.... So , how to include shell enviroment to my program..Is there anyway of doing that or any other method by which I am able to do such stuff? Secondly,,,,.when I use var file = new File("/home/pawan/text.txt"). It creates file named test.txt in home of user pawan.... function createFile() { jslib.init(this); include (jslib_file); var file = new File("test.txt"); file.open("w"); file.write("This is a first file created by browser\n"); file.close(); } This program I am using to create file ...but it does not create file..I don't know y ...May be its creating the file from where firefox is invoked... But how to create file in my chrome://somename/content/ I want to create file in this folder.... Thanks in advance, Pawan Kumar pawan_sin99 wrote: > > Thanks it worked...!!! > > Peter Leugner wrote: >> >> >> You can start a local server that's listening to a socket and redirect >> stdout to that socket with the help of netcat >> >> Example: >> >> var listener = { >> onStopListening: function() {}, >> onSocketAccepted: function(server, transport) { >> >> try { >> var stream = transport.openInputStream(0,0,0); >> var instream = Components.classes >> ["@mozilla.org/scriptableinputstream;1"].createInstance >> (Components.interfaces.nsIScriptableInputStream); >> instream.init(stream); >> } catch (e) { >> alert("Error "+e); >> } >> >> var dataListener = { >> data:"", >> >> onStartRequest: function(request, context) { >> this.data=""; >> }, >> >> onStopRequest: function(request, context, status) { >> instream.close(); >> // this.data has the sent data >> }, >> >> onDataAvailable: function(request, context, inputStream, offset, >> count) { >> this.data = this.data + instream.read(count); >> } >> }; >> >> var pump = Components.classes >> ["@mozilla.org/network/input-stream-pump;1"].createInstance >> (Components.interfaces.nsIInputStreamPump); >> pump.init(stream, -1, -1, 0, 0, false); >> pump.asyncRead(dataListener,null); >> } >> }; >> >> function startServer() { >> >> try{ >> var socket = Components.classes >> ["@mozilla.org/network/server-socket;1"]; >> server = socket.createInstance(); >> server = >> server.QueryInterface(Components.interfaces.nsIServerSocket); >> >> server.init(6669,true,-1); >> server.asyncListen(listener); >> } >> catch (e){ >> alert("Error: "+e); >> } >> >> } >> >> function stopServer() { >> if (server) server.close(); >> } >> >> >> Start the server and then start the script piping the output like >> >> ls | nc localhost 6669 >> >> Good luck, >> >> Peter Leugner >> --------------------------------------------------------------------- >> Leiter IT Anwendungsentwicklung >> Tel.: +49 (0) 89 45 06 63 26 >> Fax: +49 (0) 89 45 06 63 81 >> e-Mail: pleugner at as-computer.de >> Web: www.as-computer.de >> >> AS Computer Consulting & Service GmbH >> Sitz: M?nchen >> Gesch?ftsf?hrer: Dipl.-Ing. (FH) Andreas Erhart >> Register: M?nchen HRB 111 507 >> >> >> |------------> >> | Von: | >> |------------> >> >> >--------------------------------------------------------------------------------------------------------------------------------------------------| >> |pawan_sin99 >> | >> >> >--------------------------------------------------------------------------------------------------------------------------------------------------| >> |------------> >> | An: | >> |------------> >> >> >--------------------------------------------------------------------------------------------------------------------------------------------------| >> |jslib at mozdev.org >> | >> >> >--------------------------------------------------------------------------------------------------------------------------------------------------| >> |------------> >> | Datum: | >> |------------> >> >> >--------------------------------------------------------------------------------------------------------------------------------------------------| >> |04/05/2009 20:39 >> | >> >> >--------------------------------------------------------------------------------------------------------------------------------------------------| >> |------------> >> | Betreff: | >> |------------> >> >> >--------------------------------------------------------------------------------------------------------------------------------------------------| >> |Re: [Jslib] Executing unix command ( such as ls ) from the jslib >> | >> >> >--------------------------------------------------------------------------------------------------------------------------------------------------| >> |------------> >> | Gesendet | >> | von: | >> |------------> >> >> >--------------------------------------------------------------------------------------------------------------------------------------------------| >> |jslib-bounces at mozdev.org >> | >> >> >--------------------------------------------------------------------------------------------------------------------------------------------------| >> >> >> >> >> >> >> So, how can we get the stdout ..because I have to display results...Is >> there >> anyway to do it........... >> >> >> >> >> Pete Collins wrote: >>> >>> nsIProcess only supports executing commands and not returning stdout >>> back to the caller ... >>> >>> --pete >>> >>> pawan_sin99 wrote: >>>> Hi, I am developing an extension which will run unix command of shell >>>> such as >>>> ls..and fetch the ls result and displays it on addon...I am not getting >>>> how >>>> to do it with jslib. >>>> >>>> >>>> Thanks in advance, >>>> Pawan Kumar >>>> >>> >>> -- >>> Pete Collins - Founder, Mozdev Group Inc. >>> www.mozdevgroup.com >>> Mozilla Software Development Solutions >>> tel: 1-719-302-5811 >>> fax: 1-719-302-5813 >>> >>> _______________________________________________ >>> Jslib mailing list >>> Jslib at mozdev.org >>> https://www.mozdev.org/mailman/listinfo/jslib >>> >>> >> >> -- >> View this message in context: >> http://www.nabble.com/Executing-unix-command-%28-such-as-ls-%29-from-the-jslib-tp22891225p22895561.html >> >> Sent from the MozDev - jslib mailing list archive at Nabble.com. >> >> _______________________________________________ >> Jslib mailing list >> Jslib at mozdev.org >> https://www.mozdev.org/mailman/listinfo/jslib >> >> !DSPAM:3,49d8fac747199060010485! >> >> >> >> >> _______________________________________________ >> Jslib mailing list >> Jslib at mozdev.org >> https://www.mozdev.org/mailman/listinfo/jslib >> >> > > -- View this message in context: http://www.nabble.com/Executing-unix-command-%28-such-as-ls-%29-from-the-jslib-tp22891225p22948660.html Sent from the MozDev - jslib mailing list archive at Nabble.com. From pete at mozdevgroup.com Wed Apr 8 07:26:26 2009 From: pete at mozdevgroup.com (Pete Collins) Date: Wed, 08 Apr 2009 08:26:26 -0600 Subject: [Jslib] Antwort: Re: Executing unix command ( such as ls ) from the jslib In-Reply-To: <22948660.post@talk.nabble.com> References: <22891225.post@talk.nabble.com> <49D8D0BC.2050902@mozdevgroup.com> <22895561.post@talk.nabble.com> <22922693.post@talk.nabble.com> <22948660.post@talk.nabble.com> Message-ID: <49DCB412.9000006@mozdevgroup.com> > > var file = new File("/home/pawan/text.txt"). > It creates file named test.txt in home of user pawan.... > > function createFile() > { > jslib.init(this); > include (jslib_file); > var file = new File("test.txt"); > file.open("w"); > file.write("This is a first file created by browser\n"); > file.close(); > } > > The file.open("w"); Creates the file ... > This program I am using to create file ...but it does not create file..I > don't know y ...May be its creating the file from where firefox is > invoked... > > But how to create file in my chrome://somename/content/ > I want to create file in this folder.... > > You need permission to write to the chrome dir. Also, in most cases "chrome://somename/content" is a mapped resource that points to a jar archive and is not a file on the filesystem. Usually for files you want to create and write to, you would place them in the mozilla/firefox profile dir which is a place you have permission to write to. --pete -- Pete Collins - Founder, Mozdev Group Inc. www.mozdevgroup.com Mozilla Software Development Solutions tel: 1-719-302-5811 fax: 1-719-302-5813 From PLeugner at as-computer.de Wed Apr 8 07:55:24 2009 From: PLeugner at as-computer.de (Peter Leugner) Date: Wed, 8 Apr 2009 16:55:24 +0200 Subject: [Jslib] Antwort: Re: Antwort: Re: Executing unix command ( such as ls ) from the jslib In-Reply-To: <22948660.post@talk.nabble.com> References: <22891225.post@talk.nabble.com> <49D8D0BC.2050902@mozdevgroup.com> <22895561.post@talk.nabble.com> <22922693.post@talk.nabble.com> <22948660.post@talk.nabble.com> Message-ID: I can't answer your first question, why dont' you put ls | myprog | nc localhost 6669 in a shell script und start this from C. maybe this works. As for your second question: https://developer.mozilla.org/en/Code_snippets/File_I%2f%2fO#Getting_special_files regards, Peter Leugner --------------------------------------------------------------------- Leiter IT Anwendungsentwicklung Tel.: +49 (0) 89 45 06 63 26 Fax: +49 (0) 89 45 06 63 81 e-Mail: pleugner at as-computer.de Web: www.as-computer.de AS Computer Consulting & Service GmbH Sitz: M?nchen Gesch?ftsf?hrer: Dipl.-Ing. (FH) Andreas Erhart Register: M?nchen HRB 111 507 |------------> | Von: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |pawan_sin99 | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | An: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |jslib at mozdev.org | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | Datum: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |04/08/2009 16:04 | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | Betreff: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |Re: [Jslib] Antwort: Re: Executing unix command ( such as ls ) from the jslib | >--------------------------------------------------------------------------------------------------------------------------------------------------| |------------> | Gesendet | | von: | |------------> >--------------------------------------------------------------------------------------------------------------------------------------------------| |jslib-bounces at mozdev.org | >--------------------------------------------------------------------------------------------------------------------------------------------------| I started sever its working fine...with command line... Now I made a c program which do system(ls | nc localhost 6669); The above statement is working fine... But when I do, system( ls | myprog | nc localhost 6669) ; myprog is in the bash file PATH of my shell....but here the system command does not find myprog path......means it is not including the PATH of the bash of shell...So After lot of search also I cannot able to debug this error.... So , how to include shell enviroment to my program..Is there anyway of doing that or any other method by which I am able to do such stuff? Secondly,,,,.when I use var file = new File("/home/pawan/text.txt"). It creates file named test.txt in home of user pawan.... function createFile() { jslib.init(this); include (jslib_file); var file = new File("test.txt"); file.open("w"); file.write("This is a first file created by browser\n"); file.close(); } This program I am using to create file ...but it does not create file..I don't know y ...May be its creating the file from where firefox is invoked... But how to create file in my chrome://somename/content/ I want to create file in this folder.... Thanks in advance, Pawan Kumar pawan_sin99 wrote: > > Thanks it worked...!!! > > Peter Leugner wrote: >> >> >> You can start a local server that's listening to a socket and redirect >> stdout to that socket with the help of netcat >> >> Example: >> >> var listener = { >> onStopListening: function() {}, >> onSocketAccepted: function(server, transport) { >> >> try { >> var stream = transport.openInputStream(0,0,0); >> var instream = Components.classes >> ["@mozilla.org/scriptableinputstream;1"].createInstance >> (Components.interfaces.nsIScriptableInputStream); >> instream.init(stream); >> } catch (e) { >> alert("Error "+e); >> } >> >> var dataListener = { >> data:"", >> >> onStartRequest: function(request, context) { >> this.data=""; >> }, >> >> onStopRequest: function(request, context, status) { >> instream.close(); >> // this.data has the sent data >> }, >> >> onDataAvailable: function(request, context, inputStream, offset, >> count) { >> this.data = this.data + instream.read(count); >> } >> }; >> >> var pump = Components.classes >> ["@mozilla.org/network/input-stream-pump;1"].createInstance >> (Components.interfaces.nsIInputStreamPump); >> pump.init(stream, -1, -1, 0, 0, false); >> pump.asyncRead(dataListener,null); >> } >> }; >> >> function startServer() { >> >> try{ >> var socket = Components.classes >> ["@mozilla.org/network/server-socket;1"]; >> server = socket.createInstance(); >> server = >> server.QueryInterface(Components.interfaces.nsIServerSocket); >> >> server.init(6669,true,-1); >> server.asyncListen(listener); >> } >> catch (e){ >> alert("Error: "+e); >> } >> >> } >> >> function stopServer() { >> if (server) server.close(); >> } >> >> >> Start the server and then start the script piping the output like >> >> ls | nc localhost 6669 >> >> Good luck, >> >> Peter Leugner >> --------------------------------------------------------------------- >> Leiter IT Anwendungsentwicklung >> Tel.: +49 (0) 89 45 06 63 26 >> Fax: +49 (0) 89 45 06 63 81 >> e-Mail: pleugner at as-computer.de >> Web: www.as-computer.de >> >> AS Computer Consulting & Service GmbH >> Sitz: M?nchen >> Gesch?ftsf?hrer: Dipl.-Ing. (FH) Andreas Erhart >> Register: M?nchen HRB 111 507 >> >> >> |------------> >> | Von: | >> |------------> >> >> >--------------------------------------------------------------------------------------------------------------------------------------------------| >> |pawan_sin99 >> | >> >> >--------------------------------------------------------------------------------------------------------------------------------------------------| >> |------------> >> | An: | >> |------------> >> >> >--------------------------------------------------------------------------------------------------------------------------------------------------| >> |jslib at mozdev.org >> | >> >> >--------------------------------------------------------------------------------------------------------------------------------------------------| >> |------------> >> | Datum: | >> |------------> >> >> >--------------------------------------------------------------------------------------------------------------------------------------------------| >> |04/05/2009 20:39 >> | >> >> >--------------------------------------------------------------------------------------------------------------------------------------------------| >> |------------> >> | Betreff: | >> |------------> >> >> >--------------------------------------------------------------------------------------------------------------------------------------------------| >> |Re: [Jslib] Executing unix command ( such as ls ) from the jslib >> | >> >> >--------------------------------------------------------------------------------------------------------------------------------------------------| >> |------------> >> | Gesendet | >> | von: | >> |------------> >> >> >--------------------------------------------------------------------------------------------------------------------------------------------------| >> |jslib-bounces at mozdev.org >> | >> >> >--------------------------------------------------------------------------------------------------------------------------------------------------| >> >> >> >> >> >> >> So, how can we get the stdout ..because I have to display results...Is >> there >> anyway to do it........... >> >> >> >> >> Pete Collins wrote: >>> >>> nsIProcess only supports executing commands and not returning stdout >>> back to the caller ... >>> >>> --pete >>> >>> pawan_sin99 wrote: >>>> Hi, I am developing an extension which will run unix command of shell >>>> such as >>>> ls..and fetch the ls result and displays it on addon...I am not getting >>>> how >>>> to do it with jslib. >>>> >>>> >>>> Thanks in advance, >>>> Pawan Kumar >>>> >>> >>> -- >>> Pete Collins - Founder, Mozdev Group Inc. >>> www.mozdevgroup.com >>> Mozilla Software Development Solutions >>> tel: 1-719-302-5811 >>> fax: 1-719-302-5813 >>> >>> _______________________________________________ >>> Jslib mailing list >>> Jslib at mozdev.org >>> https://www.mozdev.org/mailman/listinfo/jslib >>> >>> >> >> -- >> View this message in context: >> http://www.nabble.com/Executing-unix-command-%28-such-as-ls-%29-from-the-jslib-tp22891225p22895561.html >> >> Sent from the MozDev - jslib mailing list archive at Nabble.com. >> >> _______________________________________________ >> Jslib mailing list >> Jslib at mozdev.org >> https://www.mozdev.org/mailman/listinfo/jslib >> >> >> >> >> >> >> _______________________________________________ >> Jslib mailing list >> Jslib at mozdev.org >> https://www.mozdev.org/mailman/listinfo/jslib >> >> > > -- View this message in context: http://www.nabble.com/Executing-unix-command-%28-such-as-ls-%29-from-the-jslib-tp22891225p22948660.html Sent from the MozDev - jslib mailing list archive at Nabble.com. _______________________________________________ Jslib mailing list Jslib at mozdev.org https://www.mozdev.org/mailman/listinfo/jslib !DSPAM:3,49dcaf0147191670490836! -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: graycol.gif Type: image/gif Size: 105 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ecblank.gif Type: image/gif Size: 45 bytes Desc: not available URL: