summaryrefslogtreecommitdiff
path: root/src/functions.php
blob: d9fbfca08e0233f9d37adfbcad3d31cdac067bb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
// src/functions.php


// commande pour lancer une application graphique en ouvrant un fichier
function windowAppCommand(string $app, string $path = ''): string
{
    // attention, ne supporte que la syntaxe la plus simple avec un seul paramètre:"app fichier"
    // fonctionne avec choisis: gimp, scribus, sqlite, "l'explorateur de fichiers par défaut"

    $command = 'nohup ' . $app; // détache l'appli du script PHP
    if($path !== '')
    {
	    $command .= ' ' . $path;
    }
    $command .= ' > /dev/null 2>&1 &';
    // stdout > /dev/null et & permettent de rendre la main à PHP
    // stderr > stdout pour cacher un message inutile
    return $command;
}