com-lihaoyi / mill

Mill is a fast JVM build tool that supports Java and Scala. 2-3x faster than Gradle and 5-10x faster than Maven for common workflows, Mill aims to make your project’s build process performant, maintainable, and flexible
https://mill-build.org/
MIT License
2.05k stars 332 forks source link

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

Closed bbarker closed 4 weeks ago

bbarker commented 6 years ago

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 commented 6 years ago

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.

pme123 commented 5 years ago

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

lefou commented 2 years ago

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

No.

lihaoyi commented 4 weeks ago

Going to call this fixed since we've overhauled the Mill client-server setup a few times since then