![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | ||
|
Programmer
Join Date: Aug 2005
Posts: 66
Rep Power: 0
![]() |
Yo all!
I'm trying to get my cgi script to talk to a java program. Basiclly the java program can be run on the command line by typing: Quote:
Quote:
Any thoughts? Thanks! ![]() |
||
|
|
|
|
|
#2 |
|
Programmer
Join Date: Aug 2005
Posts: 66
Rep Power: 0
![]() |
Warg....O.K...I'm getting closer...
so, popen2 actually seems to work "somewhat" but not in the manner i need it to. popen2 returns a "sub shell" type of deal. It returns 2 fdopen objects, one for the output and one for inputting like the shell stdin. for instance: from popen2 import popen2
r, w = popen2('wc -w')
w.write('foo foo foo')
w.flush()
w.close()
print r.read()
3However, the java program I'm using prints "password: " to the screen and waits for a password. w.write dosen't seem to give it the password, and then even after I've closed the pipe ( w.close() ) it STILL keeps spitting the "password:" string at me. So, I figure that either the java program is doing some sort of fork, or using threads, or not taking it's input from stdin or something funkey like that. Guess my next step is to write my own java program to emulate the program I'm working with and try to see what type of code adjustments I'll need to make in order to get this thing working....blech....editing and code-crawling other people's java code...ah well, such is the way of the programming world. ![]() |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Aug 2005
Posts: 66
Rep Power: 0
![]() |
Ahhhhhhhhhhh...O.K. The java program talks to div-tty, and dosen't actually touch the stdin. That makes sence now why the program kept spitting the password prompt at me. CGI dosen't actually have a tty and thus the program was stuck waiting for input from a source that cannot be written to.
lol...guess I really didn't have to post all this...but hey...might be useful to some other fokes round' er'. :p |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|