mill icon indicating copy to clipboard operation
mill copied to clipboard

Apparent blocking occurs when reading standard input when using `mill -i`

Open bbarker opened this issue 7 years ago • 3 comments

As discussed on gitter mill -i should allow for standard input to be read in from code being executed by mill. However, when I tried this with this minimal project, it seems to hang/block when executing readLine.

bbarker avatar May 17 '18 14:05 bbarker

In a bizarre turn of events, if you launch the scala console via mill, you can get early termination (type any key and readPassword will immediately return, followed by corrupted output to the console (multiple characters appearing for each key typed, etc):

$ mill -i sbh.core.console                                                                                                           
Compiling (synthetic)/ammonite/predef/interpBridge.sc                                                                                 
Compiling /home/brandon/workspace/sbh/build.sc                                                                                        
[53/53] sbh.core.console                                                                                                              
Welcome to Scala 2.12.6 (OpenJDK 64-Bit Server VM, Java 1.8.0_172).                                                                   
Type in expressions for evaluation. Or try :help.                                                                                     
                                                                                                                                                                                                                       
scala> import edu.cornell.cac.sbh.Util._                                                                                              
import edu.cornell.cac.sbh.Util._                                                                                                     
                                                                                                                                      
scala> readPassword(None)                                                                                                             
                                                                                                                                      
res0: Array[Char] = Array(A)                                                                                                          
                                                                                                                                      
scala> SSDDFF^^^^?^?^?^?^?^?^?^?^M                                                                                                    
                                                                                                                                      
scala> ^M                                                                                                                             
                                                                                                                                      
scala> aassddffllkkjj^M                                                                                                               
<console>:16: error: not found: value asdflkj                                                                                         
       asdflkj                                                                                                                        
       ^                                                                                                                              
                                                                                                                                      
scala> ::qquuiitt^M                         

However, Util.readLine seems to work here.

bbarker avatar May 17 '18 21:05 bbarker

Is this also related to my problem? https://stackoverflow.com/questions/57082367/why-does-running-the-zio-app-with-mill-not-work

pme123 avatar Jul 18 '19 06:07 pme123

Is this also related to my problem? https://stackoverflow.com/questions/57082367/why-does-running-the-zio-app-with-mill-not-work

No.

lefou avatar Oct 12 '21 08:10 lefou