Back Midas Rome Roody Rootana
  Midas DAQ System  Not logged in ELOG logo
Entry  19 Nov 2025, Stefan Mathis, Forum, Control external process from inside MIDAS 
    Reply  19 Nov 2025, Nick Hastings, Forum, Control external process from inside MIDAS 
       Reply  20 Nov 2025, Stefan Mathis, Forum, Control external process from inside MIDAS 
          Reply  20 Nov 2025, Nick Hastings, Forum, Control external process from inside MIDAS 
             Reply  20 Nov 2025, Stefan Mathis, Forum, Control external process from inside MIDAS 
                Reply  24 Nov 2025, Stefan Ritt, Forum, Control external process from inside MIDAS 
                   Reply  27 Nov 2025, Konstantin Olchanski, Forum, Control external process from inside MIDAS 
Message ID: 3155     Entry time: 27 Nov 2025     In reply to: 3132
Author: Konstantin Olchanski 
Topic: Forum 
Subject: Control external process from inside MIDAS 
> Rather than investing time to re-invent the wheel here, better try to modify your EPICS driver process to 
become a midas process.

I am with Stefan on this. Quite a bit of work went into the tmfe c++ framework to make it easy/easier to do 
this - take an existing standalone c/c++ program and midas-ize it: in main(), "just add" calls to connect to 
midas and to start the midas threads - rpc handler, watchdog, etc.

Alternatively, one can write a midas "stdout+stderr bridge", and start your standalone program
from the programs page like this:

myprogram |& cm_msg_bridge --name "myprogram" (redirect both stdout and stderr to cm_msg_bridge stdin)

cm_msg_bridge would read stdin and put them in cm_msg(). it will connect to midas using the name "myprogram" 
to make it show "green" on the status page and it will be stoppable from the programs page.

care will need to be taken for myprogram to die cleanly when stdout and stderr are closed after cm_msg_bridge 
exits.

K.O.
ELOG V3.1.4-2e1708b5