"There are stopped jobs" when I try to quit terminal

461

The reason that this happens is because there is a stopped job still open in that terminal window (duh!). Typically this happens when a program is run and suspended (with ctrlz).

To get a list of such jobs, use the command jobs on the terminal and use fg to revive each of those jobs and quit them properly. Once this is done, terminal can be exited normally.

Of course, a simpler solution (not one that I would advise, though) would be to simply close the terminal with the mouse, ignoring any warning messages.

[source]

Share:
461

Related videos on Youtube

bo-oz
Author by

bo-oz

Updated on September 18, 2022

Comments

  • bo-oz
    bo-oz almost 2 years

    I also posted a related question: https://stackoverflow.com/a/50613524?noredirect=1, which was more about this concept.

    What I'm trying to do is the following: I want to find Accounts for which a certain User has created a Report, or for which a user has a deadline.

      scope :active_accounts_for_user, -> (user) {
        joins(:deadlines)
        .where(:deadlines => {user: [nil, user]})
        .joins(:reports)
        .where(:reports => {user: user, day: (Date.today - 1.day..Date.today)})
      }
    

    Problem with this is that Rails created an AND query, so it will find only Accounts that both have a report and a deadline. That is obviously to restrictive for my usecase.

    Edit: Ok, I found a solution, I'd like to confirm whether this is good practive though. I'm basically creating separate queries to both Models in order to fetch the account ID's, which I use in a simple where:

      scope :active_accounts_for_user, -> (user) {
        accounts_with_reports = Report.where(user: user).where('date > ?', 24.hours.ago).pluck(:account_id)
        accounts_with_deadlines = Deadline.where(user: user).pluck(:account_id)
        account_ids = (accounts_with_reports + accounts_with_deadlines).compact
        return includes(:past_deadlines, :deadlines).where(id: account_ids)
      }
    

    Is this a correct use of a scope?

  • Jagdeep Singh
    Jagdeep Singh about 6 years
    Even though the link you mentioned might solve the question, but it is more appropriate to include the relevant part of code here too. Otherwise, it could well be a comment on the question only.
  • bo-oz
    bo-oz about 6 years
    This only works in Rails 5 unfortunataly. Is there a Rails 4 equivalent?
  • maicher
    maicher about 6 years
    It was added in rails 5.0 github.com/rails/rails/blob/5-0-stable/activerecord/… Previous versions don't support or queries. The need to be written using pure SQL.
  • bo-oz
    bo-oz about 6 years
    Won't Left Joins give me all the Accounts?
  • Phil
    Phil about 6 years
    The where clause should cover that by limiting the user and day range if a deadline is set. That said, you'll need to extend the conditions to exclude results where both deadline and report are NULL. I'll edit my answer to include a possibility for this.
  • bo-oz
    bo-oz about 6 years
    Thanks, great solution.
  • khiav reoy
    khiav reoy about 6 years
    You could try rails_or which implements or method for Rails 3 and Rails 4