Commit graph

8 commits

Author SHA1 Message Date
Sam Atkins 00b897af8f LibCore: Add nice get/set_process_name() wrappers in Core::Process
`Process::get_name()` and `Process::set_name()` are basically the same
as `get_process_name()` and `set_process_name()`, except making use of
convenient Serenity standard types and returning ErrorOr, instead of
char* and errno shenanigans.

`Process::set_name()` has an optional `SetThreadName` parameter, for
when you also want to set the thread's name to the same thing. That's
true for the two places that use `set_process_name()`.
2023-01-25 14:27:45 +01:00
Linus Groh 6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
cflip 953520df49 LibCore: Add argument to specify working directory in Process::spawn 2022-10-17 01:37:58 +02:00
Andrew Kaster 828441852f Everywhere: Replace uses of __serenity__ with AK_OS_SERENITY
Now that we have OS macros for essentially every supported OS, let's try
to use them everywhere.
2022-10-10 12:23:12 +02:00
sin-ack a3eeeaa6a1 Userland: Remove erroneous String -> char* -> StringView conversions
These were accidental (or leftover) uses of String::characters() to
construct StringViews through its StringView(char const*) constructor.
Since this constructor is due to be removed, this will no longer work.
Plus this prevents strlen from being run on these strings unnecessarily.
2022-07-12 23:11:35 +02:00
MacDue 3fc0350caf LibCore: Return ErrorOr<pid_t> and support arguments in Process::spawn
This makes the wrapper more like the rest in LibCore, and also
removes the annoying limitation of not supporting arguments.

There are three overloads one for String, char const *, and StringView
argument lists. As long as there are <= 10 arguments the argv list
will be allocated inline, otherwise on the heap.
2022-05-25 23:14:22 +01:00
Andreas Kling f5c3225286 LibCore: Explicitly declare environ in Process.cpp to unbreak macOS 2021-08-06 01:29:09 +02:00
Andreas Kling 6e65b36973 LibCore: Add Core::Process::spawn()
This is a simple wrapper around posix_spawn() that will help us simplify
a bunch of very verbose posix_spawn() invocations.

This first version only supports the simplest case: executing an
executable without passing arguments or doing anything fancy. More
features can be added to cover more cases. :^)
2021-08-06 01:04:11 +02:00