Issue573791

classification
Title: os.system partly broken
Type: Severity: normal
Components: None Versions:
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: kevinbutler Nosy List: kevinbutler
Priority: normal Keywords:

Created on 2002-06-25.19:52:57 by anonymous, last changed 2002-12-19.22:08:20 by kevinbutler.

Messages
msg675 (view) Author: Nobody/Anonymous (nobody) Date: 2002-06-25.19:52:57
executing a external command can hang jython interpretor  
when using os.system  
  
eg. os.system("more file1") causes a hang under jython but  
works under native python.  
  
eg. os system("cat file1") works under both.  
  
Addditionally, output can vary slightly, eg:  
  
file 1 contains: 
 
test text 
 
 
python code:  
  
result = os.system("cat file1")  
print "=-=-=-="  
print result  
  
produces under python 
 
test text 
=-=-=-= 
0 
 
under jython:  
  
test text=-=-=-= 
0 
  
   
Running under Linux - Mandrake 8.2 using    
j2sdk1.3.1-02b-FCS (blackdown) with jython 2.1   
msg676 (view) Author: Kevin J. Butler (kevinbutler) Date: 2002-12-19.22:08:20
Logged In: YES 
user_id=117665

Fixed the first half, by closing the sub-process's std input
stream.

However, I cannot duplicate the different behavior between
jython & python:

With a go.py containing:
---
import os
r = os.system( "cat /tmp/nocr" )
print "=-=-=-"
print r
r = os.system( "cat /tmp/cr" )
print "=-=-=-"
print r
---
And 'nocr' and 'cr' containing text without and with a final
carriage return, I get the following output:

butler@wind:/opt/jython/Lib$ python /tmp/go.py
no carriagereturn=-=-=-
0
carriagereturn
=-=-=-
0
butler@wind:/opt/jython/Lib$ jythoncvs /tmp/go.py
no carriagereturn=-=-=-
0
carriagereturn
=-=-=-
0
History
Date User Action Args
2002-06-25 19:52:57anonymouscreate