File: virt-sandbox.js

package info (click to toggle)
libvirt-sandbox 0.5.1%2Bgit20160404-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,104 kB
  • ctags: 1,964
  • sloc: ansic: 12,696; python: 2,110; makefile: 447; sh: 302; xml: 151; perl: 110
file content (37 lines) | stat: -rwxr-xr-x 709 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/gjs

const LibvirtGObject = imports.gi.LibvirtGObject;
const LibvirtSandbox = imports.gi.LibvirtSandbox;
const Gtk = imports.gi.Gtk;

LibvirtGObject.init_object_check(null, null);

var cfg = LibvirtSandbox.ConfigInteractive.new("sandbox");
/* XXX how to set argv & check if stdin is a tty ? */
cfg.set_tty(true);

var conn = LibvirtGObject.Connection.new("qemu:///session");
conn.open(null)

var ctxt = LibvirtSandbox.ContextInteractive.new(conn, cfg);
ctxt.start();

var con = ctxt.get_console()

var closed = function(error) {
    Gtk.main_quit();
}

con.connect("closed", closed);

con.attach_stdio()

Gtk.main()

try {
    con.detach()
} catch (err) {}

try {
    ctxt.stop();
} catch (err) {}