123456789101112131415161718192021222324252627282930 |
- import QtQuick 2.0
- import Process 1.0
- Process {
- id: process
- property string output
- property string scriptsPath: applicationDirPath + "/../scripts/"
- function exec(text) {
- output = ""
- console.log(`starting: bash -c [${text}]`)
- start("bash", ["-c", text])
- }
- function execScript(name, args) {
- let argsList = typeof args === "string" ? [args] : args || []
- var strArgs = ""
- for (let arg of argsList) {
- strArgs += ` '${arg.replace(/'/g, "\\\'")}'`
- }
- exec(`"${scriptsPath + name}"${strArgs}`)
- }
- onOutputRead: {
- process.output = process.output + output
- }
- }
|