I can't figure out how to call a bash command from Haxe

267 views Asked by At

I'm trying to make a very specialized "desktop environment" for some younger family members using Armory 3D which uses Haxe as a backend. It is basically a kiosked interface on top of Linux which only allows users to run specific programs and games. I have the button event linked to a function which is supposed to run a system app through bash. The problem is that I don't know how to call a bash (or any other kind of script/command/program) through Haxe.

I've tried searching around online for example code. I've seen people use -cmd <command> and Sys.command('<command>') but I'm not sure how to use these commands or if they require a certain setup to run.

This is going to be running on Linux 64-bit:

import Sys;
import iron.App;
import armory.system.Event;
import armory.trait.internal.CanvasScript;
...
            // Notify on button click
            Event.add("menu.Opera", runOpera);
        });
    }

    function runOpera() {
        Sys.command('bash opera');
    //  -cmd    'bash /usr/bin/opera';
    }
}

I want it to simply launch the Opera browser because my "desktop environment" will be using browsers quite frequently. It doesn't launch anything regardless of the method I try to use to launch applications. I've been getting this error when using Sys.command('<command>');:

27: characters 3-14 : Accessing this field requires a system platform (php,neko,cpp,etc.)

And when using -cmd '<command>'; I get:

28: characters 4-7 : Missing ;

I feel like I'm messing something up here but I have no prior knowledge of Haxe syntax.

[Edit] I'd like to point out that I've looked just about everywhere and cannot find anything reliable for launching system apps from Haxe.

0

There are 0 answers