나는 아주 동일한 질문을하고 있습니다. 아직 그렇게하는 좋은 방법을 찾지 못했습니다. 현재 내가 그렇게 할이 비 이상적 접근 방법을 시도하고있다 :
- 하드 코드 경로, 예컨대 :
~/.local/share/gnome-shell/extensions/[email protected]/mybinary
가 확장에서 전 세계적으로 독립적 인 바이너리를 설치합니다. 당신이 경로를 일단
당신은 예를 들어 Util.spawnCommandLine
사용할 수 있습니다
const Util = imports.misc.util;
Util.spawnCommandLine('/path/to/your/bin');
또는 GLib.spawn_async
당신이 콜백 필요로하는 경우 :
const GLib = imports.gi.GLib;
let [success, pid] = GLib.spawn_async(null,
['/path/to/your/bin', '--param1','--param2'],
null,
GLib.SpawnFlags.SEARCH_PATH | GLib.SpawnFlags.DO_NOT_REAP_CHILD,
null);
if (!success) {
global.log('ERROR NO SUCCESS');
return;
}
GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid, function (pid, status) {
GLib.spawn_close_pid(pid);
if (status !== 0 && status !== '0') {
global.log('ERROR');
}
else {
global.log('SUCCESS', status);
}
});
이 내가 부족 조각이되는 경우를 헬퍼 메소드를 통해 확장 경로를 얻는 방법. 그러나 문서가 끔찍하게 개발되지 않았기 때문에 소스 코드를 찾지 못해서 아직 해결책을 찾지 못했습니다.