diff options
Diffstat (limited to 'terminal.vala')
-rw-r--r-- | terminal.vala | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/terminal.vala b/terminal.vala index e2c8d48..67256d4 100644 --- a/terminal.vala +++ b/terminal.vala @@ -80,16 +80,26 @@ class Terminal : Gtk.Overlay { var regex = new Vte.Regex.for_match(URL_REGEX, URL_REGEX.length, PCRE2_CASELESS | PCRE2_MULTILINE); vte.match_add_regex(regex, 0); vte.match_set_cursor_name(0, "pointer"); - - var argv = args[1:args.length]; - if (argv.length == 0) { - argv = { Utils.get_shell() }; - } - - vte.spawn_sync(DEFAULT, null, argv, null, SEARCH_PATH, null, out child_pid, null); } catch (Error e) { error(e.message); } + + var argv = args[1:args.length]; + if (argv.length == 0) { + argv = { Utils.get_shell() }; + } + + Vte.TerminalSpawnAsyncCallback callback = this.spawn_terminal_callback; + vte.spawn_async(DEFAULT, null, argv, null, SEARCH_PATH, null, -1, null, callback); + } + + void spawn_terminal_callback(Vte.Terminal terminal, Pid pid, Error? error) { + if (error != null) { + print("weltschmerz: %s\n".printf(error.message)); + Process.exit(1); + } + + this.child_pid = pid; } Gtk.PolicyType get_scrollbar_policy(bool want_scrollbar) { |