Setup: Ubuntu 12.04, 32 bit; Scala 2.9.1; Java 1.6.0_24
Description:
On the bash command line, the command /usr/bin/timeout 10 scala -version works fine, it gets stuck when executed in a bash script.
Execution on the command line (duration < 1 seconds):
user@ubuntu :~$ /usr/bin/timeout 10 scala -version Scala code runner version 2.9.1 -- Copyright 2002-2011, LAMP/EPFL user@ubuntu :~$ echo $? 1
The command itself, placed in a bash script, is stuck:
testScript.sh :
#!/bin/bash /usr/bin/timeout 10 scala -version echo "finished with $?"
Running testScript.sh (duration 10 seconds):
user@ubuntu :~/scripts$ ./testScript.sh Scala code runner version 2.9.1 -- Copyright 2002-2011, LAMP/EPFL finished with 124 user@ubuntu :~/scripts$
Note. The problem does not occur with Java (which is used by Scala), it seems to be a Scala problem.
Question: Why is the timeout call in the script stuck?
How can I fix this / What would be a good way?
source share