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 8799463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:19:48+00:00 2026-06-14T00:19:48+00:00

I have a Ruby program that, amongst other things, executes user-defined blocks of code

  • 0

I have a Ruby program that, amongst other things, executes user-defined blocks of code (the code is on Github, here). Many of these blocks contain system commands, and I’m trying to debug a very specific case of executing a piece of AppleScript within a bash script that I’m calling. The script in question is for controlling Spotify by the command line, and this is the code.

The problem I’m getting is that an abort trap error is occurring every time the script is run:

spotify: line 57: 94108 Abort trap    osascript -e 'tell application "Spotify" to pause'

This must be related to the environment of the Ruby script where the call is made, but I’m having trouble seeing why. Here’s the block of code calling it:

# Ruby code
reaction :hello do |event|
  system "spotify pause"
  system "say 'Hello world'"
  system "spotify play"
end

This block is run periodically via a yield statement, when a particular event is triggered through a socket connection. The script is also daemonized, using the ruby gem “daemons”, to allow it to run in the background (but still as the current user, according to ps and the ruby environment variable). Not only this, but each socket connection starts a new thread, so the code is run in a separate thread from the main one.

In my debugging I’ve tried running the line system "spotify pause" after the daemon starts up the script, without a problem. It also runs fine in the following script:

Thread.new do
  system("spotify pause")
end

So it isn’t starting a new thread or daemonizing in itself that causes the problem, but it seems to be a combination of these things and maybe the fact that the block is being yielded that means that an abort trap is being raised by the AppleScript in the bash script.

If you can drag yourself up the many, many layers of complication back into reality, I would appreciate any suggestions you have for solving or even debugging this weird case!

  • 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-14T00:19:49+00:00Added an answer on June 14, 2026 at 12:19 am

    As @regulus6633 mentioned, this is due to Apple’s NSApplescript not being thread safe. This combined with daemonizing leads to unpredictable behaviour.

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

Sidebar

Related Questions

I have been looking at ways to program a UI in ruby here, on
I have a Ruby program that zips a directory tree of XML files using
I have a Ruby program that loads up two very large yaml files, so
I have a Ruby program that generates files that contain a Module definition :
I have a ruby program, and I want to accept the user's made up
I have a basic ruby program, that listens on a port (53), receives the
I have a Ruby program that takes as input an HTML document. The structure
This question contains java and ruby. I have a java program that I make
In a Ruby program I have a password that is a Base64 string and
Im working on Ruby c extension, I have following code from c program, VALUE

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.