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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:38:47+00:00 2026-05-31T15:38:47+00:00

I am writing an extension for the gnome-shell. The javascript extension spawns a sql

  • 0

I am writing an extension for the gnome-shell. The javascript extension spawns a sql query and captures the output on standard output. In cases where the sql query evaluates to 0 tuples/records my extension is crashing.

Below is the code snippet.

let [success, out, err, error] = GLib.spawn_sync(null, ["sqlite3", "-line", places, sqlQuery], null, 4, null);
let result = out.toString(); // Crashing here for 0 tuples. I was expecting 'result = ""'

I am a javascript newbie. I am not understanding how the object out should be handled in this scenario. The object is not null; nor is it undefined.

typeof out == null // false
typeof out == undefined // false
typeof out == "object" // true

EDIT

typeof out == "null" // false
typeof out == "undefined" // false
typeof out == "object" // true
  • 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-05-31T15:38:49+00:00Added an answer on May 31, 2026 at 3:38 pm

    I found out that I could prevent the crash if I did the following

    let [success, out, err, errno] = GLib.spawn_sync(null, ["sqlite3", "-line", places, sqlQuery], null, 4, null);
    if (out.length > 0) {
            let records = out.toString().split('\n\n');
    }
    

    I don’t understand why out.toString() couldn’t give me an empty string instead of crashing, yet. Hoping I will as I learn more about javascript and glib.

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

Sidebar

Related Questions

I am writing an extension for the gnome-shell. The javascript extension spawns a sql
I am writing an extension for Mediawiki. If I know the page_id and page_title
I'm writing an extension for Firefox, and I need to log some data to
I'm writing a Firefox extension and I need to find the ip address of
I am writing a python extension that seems to be leaking memory. I am
I'm writing a Firefox extension that's to be used in house. Basically, I need
I'm writing a Python extension that runs through a Py_UNICODE array, finds specific (ASCII,
I am writing a firefox extension that interacts with a JSON server interface. I
I am writing a Chrome Extension that inserts a DIV on top of an
I am writing a C++ extension for Python using SWIG. From what I understand

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.