V
V
Vyacheslav2020-03-22 21:06:59
JavaScript
Vyacheslav, 2020-03-22 21:06:59

How to track the termination of printing in the console?

I have a console script running. It prints intermediate results to the console as it works. Sometimes it freezes. I want to run this script with another script, so that when it hangs, that is, it does not print for a long time, the calling script sends to the console CTRL+C. This usually brings him to his senses and he continues to work. The calling/listening script must be written in Python or bat , Python is preferred. The second script is written in Python. Please tell me the solutions you know.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Fakeman Cat, 2019-08-26
@SonyFan23

let valute = {
    AMD: {ID: 'R01060', NumCode: '051', CharCode: 'AMD', Nominal: 100, Name: 'Армянских драмов', Value: 13.7825},
    AUD: {ID: 'R01010', NumCode: '036', CharCode: 'AUD', Nominal: 1, Name: 'Австралийский доллар', Value: 13.7825}
};

let string = '';

for (let [key, _value] of Object.entries(valute)) {
    string += `${key}:\n`;

    for (let [prop, value] of Object.entries(_value)) {
        string += `${prop}: ${value}\n`;
    }

    string += '\n';
}

console.log(string);

5d64175617a85651713255.png

R
res2001, 2020-03-23
@res2001

Do redirect the output of the second script to a file, then by the size of the file you can determine that it has been idle for some time.
Or it can be more technologically advanced - in the launching script, you redirect to the pipe for the one being launched and work with the channel, not with the file.
But it would be better to find out the reasons for the script freezing and deal with them, rather than invent crutches.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question