How Launch a terminal command from native app in background?

Is there a way, any tutorial or specific function to launching a command from a native Haiku app to the Terminal?
And is it possible the console app stay in background. I try use the system function but the console app take the priority over my native app. And I can’t quit the Console app by my native app for now.

You’ll want to look at the BRoster Launch() function: https://www.haiku-os.org/docs/api/classBRoster.html

1 Like

Do you need to execute it in the terminal, or just parse it’s output (stdout / stderr)?

I’ve built something for Paladin (based on something in Expander) to execute commands (E.g. compilation) and grab the output. It’s still being tested but is working pretty well. It’s called the CommandThread. Latest version (still some kinks) available here: https://github.com/adamfowleruk/Paladin/tree/develop/Paladin/PreviewFeatures

Some other potentially useful and generic stuff in that folder too. Hence ‘Preview Features’ - stuff that could be useful to all native developers.

2 Likes

I must execute a Terminal command that launch a command line app from a native window app. Thanks. Paladin have certainly an example in it for compilation of users sources.

I dont know if this solve your problem, nur i use a c binary to start my yab program

http://besly.de/index.php/en/development/c-c/run-a-shell-script-or-command-with-c

1 Like

I have test with system command in a cpp file to directly input a command that work but the command app take the priority over the main native app. But i don’t use shell script file for launch it…Maybe is a good way…But i must send parameters afters in the command lines. I will go test it.

Not work well with the shell script method. (The command line app take the priority over my native app like the system command)

I have put a & after the script for trying resolve this trouble of priority, but that make buggy the command line app.

And by this way I must launch a terminal for launch my native app. I will go checking Paladin sources

Why do you need a terminal window open?

It was for make a audio application that use fluidsynth. But I have find a library on her website. I can now work with it directly. (The library is also availible in HeikuBeos depot)

2 Likes