mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 01:37:36 +00:00
HackStudio: Add optional parameters to TerminalWrapper::run()
The optional parameters allow specifying a working directory and controlling whether or not to block until the command returns.
This commit is contained in:
parent
3afd17db9d
commit
afb4c447b4
2 changed files with 36 additions and 4 deletions
|
@ -16,8 +16,11 @@ class TerminalWrapper final : public GUI::Widget {
|
|||
C_OBJECT(TerminalWrapper)
|
||||
public:
|
||||
virtual ~TerminalWrapper() override;
|
||||
|
||||
void run_command(const String&);
|
||||
enum class WaitForExit {
|
||||
No,
|
||||
Yes
|
||||
};
|
||||
void run_command(const String&, Optional<String> working_directory = {}, WaitForExit = WaitForExit::No);
|
||||
void kill_running_command();
|
||||
void clear_including_history();
|
||||
|
||||
|
@ -30,6 +33,7 @@ public:
|
|||
};
|
||||
ErrorOr<int> setup_master_pseudoterminal(WaitForChildOnExit = WaitForChildOnExit::Yes);
|
||||
static ErrorOr<void> setup_slave_pseudoterminal(int master_fd);
|
||||
int child_exit_status() const;
|
||||
|
||||
Function<void()> on_command_exit;
|
||||
|
||||
|
@ -39,6 +43,8 @@ private:
|
|||
RefPtr<VT::TerminalWidget> m_terminal_widget;
|
||||
pid_t m_pid { -1 };
|
||||
bool m_user_spawned { true };
|
||||
bool m_child_exited { false };
|
||||
Optional<int> m_child_exit_status;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue