Skip to content

Commit

Permalink
Merge branch 'jeremypw/gtk4' into jerempw/fix-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremypw authored Nov 24, 2024
2 parents 23ee961 + c2e2004 commit 60b52cd
Showing 1 changed file with 41 additions and 12 deletions.
53 changes: 41 additions & 12 deletions src/Widgets/TerminalWidget.vala
Original file line number Diff line number Diff line change
Expand Up @@ -716,29 +716,58 @@ namespace Terminal {

/* We need opening uri to be available asap when constructing window with working directory
* so remove idle loop, which appears not to be necessary any longer */
try {
this.spawn_sync (Vte.PtyFlags.DEFAULT, dir, { shell },
envv, SpawnFlags.SEARCH_PATH, null, out this.child_pid, null);
} catch (Error e) {
warning (e.message);
}
this.spawn_async (
Vte.PtyFlags.DEFAULT,
dir,
{ shell },
envv,
SpawnFlags.SEARCH_PATH,
null,
-1,
null,
(terminal, pid, error) => {
if (error == null) {
this.child_pid = pid;
} else {
warning (error.message);
}

check_cwd_changed ();
check_cwd_changed ();
}
);
}

public void run_program (string _program_string, string? working_directory) {
string[]? program_with_args = null;
this.program_string = _program_string;
try {
string[]? program_with_args = null;
this.program_string = _program_string;
Shell.parse_argv (program_string, out program_with_args);

this.spawn_sync (Vte.PtyFlags.DEFAULT, working_directory, program_with_args,
null, SpawnFlags.SEARCH_PATH, null, out this.child_pid, null);
} catch (Error e) {
warning (e.message);
feed ((e.message + "\r\n\r\n").data);
active_shell (working_directory);
return;
}

this.spawn_async (
Vte.PtyFlags.DEFAULT,
working_directory,
program_with_args,
null,
SpawnFlags.SEARCH_PATH,
null,
-1,
null,
(terminal, pid, error) => {
if (error == null) {
this.child_pid = pid;
} else {
warning (error.message);
feed ((error.message + "\r\n\r\n").data);
active_shell (working_directory);
}
}
);
}

public bool try_get_foreground_pid (out int pid) {
Expand Down

0 comments on commit 60b52cd

Please sign in to comment.