Subject: mailing-list for TeXmacs Users
List archive
From : Massimiliano Gubinelli <address@hidden>- To: Nicola Mingotti <address@hidden>
- Cc: texmacs-users <address@hidden>
- Subject: Re: [TeXmacs] Is SIGINT sent to plugins ?
- Date: Tue, 11 Dec 2018 23:21:10 +0000
Hi Nicola,
> On 11. Dec 2018, at 20:11, Nicola Mingotti <address@hidden> wrote:
>
> Hi again,
>
> I am puzzled, I am trying to get the SIGINT from my plugin
> but it seems to me TeXmacs is not sending that signal.
>
> I am using TeXmacs version 1.99.4 in FreeBSD.
>
> Do you know of any plugin who is actually managing SIGINT correctly ?
> I tried Python (not working, not implemented IFACSay), Scheme (no button),
> Maxima (not working).
>
> I test the SIGINT is not working in this way, for Python i can actually
> check there is not signal receiver in the code, so, not a TeXmacs problem,
> but the method I use in general is:
>
> 1] Run a sleep command, 10 seconds
> 2] Press the STOP button in TeXmacs
> 3] Run a simple arithmentic command e.g. 1+1
>
> === Pyjhon ===
> > import time
> > timp.sleep(10)
> PRESS QUIT
> > 1+1
> HANGS till end of sleep
> =============
>
> ==== Maxima ====
> > :lisp (sleep 10)
> PRESS QUIT
> > 1
> HANGS till end of sleep
> ================
>
> Maybe also Maxima plugin is not catching the SIGINT...
> In my plugin managed to receive the signal but I don't see it coming when i
> press the STOP button.
>
> Do you know something about it ?
indeed it seems strange behaviour. I tried to write a small C++ plugin to
catch the SIGINT but seems not be able to manage it. Anyway looking into the
code in TeXmacs it seems indeed that the SIGINT is generated. I do not
understand. Maybe one would have to debug the source code to check that
indeed the command is called.
The relevant part of code is in qt_pipe_link.cpp
right now I’m not able to do it.
Best
Max
ps: below the code I used to try.
#include <iostream>
#include <unistd.h>
#include <csignal>
using namespace std;
#define DATA_BEGIN ((char) 2)
#define DATA_END ((char) 5)
#define DATA_ESCAPE ((char) 27)
bool trig = false;
void signalHandler( int signum ) {
// cout << DATA_BEGIN << "verbatim:";
cout << "Interrupt signal (" << signum << ") received.";
cout << DATA_END;
cout.flush ();
// cleanup and close up stuff here
// terminate program
trig = true;
//exit(signum);
}
int
main () {
cout << DATA_BEGIN << "verbatim:";
cout << "STARTING\n";
cout << DATA_END;
cout.flush ();
// register signal SIGINT and signal handler
signal(SIGINT, signalHandler);
cout << DATA_BEGIN << "verbatim:";
while (1) {
cout << "Going to sleep...." << endl;
//cout << DATA_END;
cout.flush ();
//sleep(1);
if (trig) {
cout << "SIGINT\n" << endl;
trig = false;
}
}
cout << DATA_BEGIN << "verbatim:";
cout << "ENDING\n";
cout << DATA_END;
cout.flush ();
return 0;
}
- [TeXmacs] Is SIGINT sent to plugins ?, Nicola Mingotti, 12/11/2018
- Re: [TeXmacs] Is SIGINT sent to plugins ?, Massimiliano Gubinelli, 12/12/2018
- Re: [TeXmacs] Is SIGINT sent to plugins ?, Massimiliano Gubinelli, 12/12/2018
- Re: [TeXmacs] Is SIGINT sent to plugins ?, Nicola Mingotti, 12/12/2018
- Re: [TeXmacs] Is SIGINT sent to plugins ?, Massimiliano Gubinelli, 12/12/2018
- Re: [TeXmacs] Is SIGINT sent to plugins ?, Nicola Mingotti, 12/13/2018
- Re: [TeXmacs] Is SIGINT sent to plugins ?, Massimiliano Gubinelli, 12/12/2018
- Re: [TeXmacs] Is SIGINT sent to plugins ?, Nicola Mingotti, 12/12/2018
Archive powered by MHonArc 2.6.19.