Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8409601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:57:22+00:00 2026-06-09T23:57:22+00:00

Setup: Ubuntu 12.04, 32 Bit; Scala 2.9.1; Java 1.6.0_24 Description: While on the bash

  • 0

Setup:
Ubuntu 12.04, 32 Bit; Scala 2.9.1; Java 1.6.0_24

Description:

While on the bash command line the command /usr/bin/timeout 10 scala -version works fine, it gets stuck when executed within a bash script.

Executing on 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 very same command put in a bash script got stuck:

testScript.sh:

#!/bin/bash
/usr/bin/timeout 10 scala -version
echo "finished with $?"

Executing 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 appear with Java (which is used by Scala), it seems to be a Scala specific problem.

Question: Why does the timeout call in the script got stuck ?

How can I fix this / What would be a good workaround ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T23:57:24+00:00Added an answer on June 9, 2026 at 11:57 pm

    Try including the --foreground option. From man timeout:

    –foreground

    When not running timeout directly from a shell prompt, allow COMMAND to read from the TTY and receive TTY signals. In this mode, children of COMMAND will not be timed out.

    Using the following test script:

    #!/bin/bash
    /usr/bin/timeout --foreground 10 scala -version
    echo "finished with $?"
    

    It appears to work fine.

    $ ./test.sh 
    Scala code runner version 2.9.1 -- Copyright 2002-2011, LAMP/EPFL
    finished with 1
    

    Without --foreground the script hangs as you’ve described.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have netbeans 6.8 with java ME platform setup on my ubuntu 9.10. My
First of all, the setup: Server: Ubuntu 10.04 server mongod --version db version v1.2.2,
I trying setup Hadoop install on Ubuntu 11.04 and Java 6 sun. I was
I am not very familiar with command line Ubuntu (leave alone copying a file
My setup: Ubuntu LAMP, application built w/ zend framework My Problem: I have a
I need to set up an amazon server. I always here setup ubuntu on
I am trying to setup Eclipse on Ubuntu 10.04. I have installed Eclipse SDK
I setup git on an ubuntu server and I was pushing the local repo
Our setup as follows: We have a local development server running Ubuntu, with a
I have setup the basic LAMP server on Ubuntu 11.10 and had a few

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.