After a certain period of time, the NodeJs exec() function ceases to create additional

I am in the process of developing a BLE scan module on nodeJs using Bluez. Below is the code snippet I have implemented:

exec('sudo hcitool lescan --duplicates &', function (error, stdout, stderr) { });

exec('sudo hcitool lescan --duplicates &', function (error, stdout, stderr) {
    var result = exec('sudo hcidump --raw &');

    /*
     * This recursive function fetches raw data from hcidump and passes it to createBeaconDevice function.
     */
    result.stdout.on('data', function (data) {
        var currentDate = new Date();
        writeLog('scanData', data, currentDate.toISOString().replace(/T/, ' ').replace(/\..+/, ''))
        createBeaconDevice(data);
    });
});

Unfortunately, the issue I am facing is that the functionality stops working after some time without any warning or error messages. Can anyone suggest what might be causing this problem? Any help will be greatly appreciated.

Answer №1

What causes it to cease functioning?

One way to address the error parameter is shown below:

function (error, stdout, stderr) {
    if (error) throw new Error(error) // for debugging purposes
    ...
}

This method can help provide insight into what goes wrong.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How to get the clean URL in AngularJS without any parameters using $location

One issue I'm facing is related to the URL structure of my application. It currently looks like this: "http://host:port/mySystem?x.system" The addition of x.system in the URL was necessary due to a legacy application requirement, but now I need the U ...

I am having difficulty accessing specific data in JSON using Searchkit's RefinementListFilter

Utilizing searchkit for a website, I am encountering issues accessing previously converted data in json format. The structure of my json directory is as follows: (...) hits: 0: _index: content _type: content _source: ...

Enhance the display in Angular2

Just started working with Angular 2 and I've encountered a problem. I have an API that loads a JavaScript file in my project. The issue is, I need to use this JS file and cannot modify it. Essentially, this JS file has some methods that make AJAX call ...

Using Node.js to retrieve a p12 certificate from the certificate repository

Is there a way to retrieve the p12 certificate from the certificate store after it has been installed? I am facing a situation where both the private key and certificate are combined in a p12 certificate and then stored in the Windows certificate store. ...

Iterate through the call feature repeatedly, ensuring that each call has a different iteration number assigned to a variable within the

I have a situation where I need to call a certain feature (which has validations) multiple times within a loop. Currently, my code successfully calls the feature 3 times. * def xxx = """ function(times){ for(i=0;i<times ...

Having trouble updating attribute through ajax requests

How can I set attribute values using ajax-jquery? Here are some snippets of code: HTML_CODE ========================================================================== <div class="col"> <ul class="nav nav-pills justify-content-end& ...

Is there a way to add a <video> tag in tinymce editor without it being switched to an <img /> tag?

I am attempting to include a <video> tag within the tinymce editor, but it keeps changing it to an <img> tag. Is there a way to prevent this conversion and keep the <video> tag intact? I want to enable videos to play inside tinymce whil ...

In Javascript, we can increment the current date by utilizing the `getDate()`

I am trying to create an if statement in JavaScript; if (nextProcessingDate > today ) { //do something } nextProcessingDate has a timestamp assigned, like 09/07/2014 12:10:17 To assign today's timestamp to the today variable, I am using this c ...

Guide on utilizing the send function in Locomotive Js

When working in Locomotive Js, how can I utilize send() within the action of a controller? It seems that only render() is provided by LCM. Could someone please offer guidance on this matter? ...

How can I safeguard my app from crashing when the initial state is set by undefined props?

What is the best way to prevent the state from crashing if props native_languages[0] does not exist? This is my attempt at protecting the app, but it still crashes when native_languages[0] does not exist: this.state = { language: props.currentDocu ...

Numerous superfluous files produced by running 'npm install' in the main application directory

After running 'npm install' in my application directory, I noticed a significant increase in files being generated outside of the node_modules folder. This was unexpected as usually only npm libraries are stored in that location. Has anyone else ...

Transfer elements from collections employing multer

Data Payload Example:- education[0][university]: jru education[0][degree]: mca education[0][specialization]: computer application education[0][certificate_pdf_url]: (binary) education[0][degree_type]: Teaching Degree education[0][years_of_study]: [&q ...

Restricting access to specific routes in Node/Express without affecting access to static files

Within my MEAN application, I have set up an API along with static web files such as index.html and login.html. //Routes app.use('/mysuperapi', require('./routes/api')); //For static files app.use(express.static('site')); I ...

Utilizing dual identifiers in a Jquery plugin

I am currently working with a jQuery plugin and I need to apply the same functionality to two different IDs. How can I achieve this? It involves a next and previous functionality where clicking on the next button automatically scrolls both divs. The issu ...

The AngularJS directive within a directive is failing to properly initialize the scope value

In my current setup, I am working with a controller that contains the value $scope.colorHex. As an example, I am utilizing the directive colorpickerTooltip, and within its template, I am calling another directive: <colorpicker ng-model="colorHex">&l ...

Exploring Node.js promises using mongoskin

Currently, I'm seeking alternatives to using callbacks for my mongodb queries. I've been utilizing mongoskin for making calls like this: req.db.collection('users').find().toArray(function (err, doc) { res.json(doc); }); As I often n ...

Attaching an input text box to an Angular $scope is not possible

In my angular app, I have a piece of markup that showcases a table with saved queries. Each query has the option to add a title using an input field. When you click the edit icon, it should display the newly created title. <table class="table table-str ...

"Step-by-step guide on using JavaScript to print a PDF file stored locally

As an illustration, I have a local PDF file with 6 pages. When using the window.print() function, only one page is displayed in print preview regardless of what is shown in the browser. Instead of just one page, all pages should be visible in print previ ...

Display Node API Data on the console

Today's challenge seems simple, but I've hit a roadblock. My aim is to send a GET request to an endpoint and then display the data in a readable format on the console. Initially, I thought I should use app.get('/'); - that's how I ...

Troubleshooting CSS Animation Failure in Internet Explorer 11

My mouse over / mouse out animation works perfectly in Firefox and Chrome, but it's not functioning in IE. Can anyone suggest why this might be happening when it was working fine before? var actual = 1; var over = 0; var over2 = 0; function scrol ...