mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-24 19:21:52 +00:00
AK: Add Error::from_windows_error(void)
Also slightly improve Error::from_windows_error(int)
This commit is contained in:
parent
c7fe7b09a5
commit
870cce9d11
Notes:
github-actions[bot]
2025-02-06 02:28:57 +00:00
Author: https://github.com/stasoid
Commit: 870cce9d11
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3166
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/gmta
5 changed files with 40 additions and 34 deletions
|
@ -71,7 +71,7 @@ ErrorOr<Process> Process::spawn(ProcessSpawnOptions const& options)
|
|||
&process_info);
|
||||
|
||||
if (!result)
|
||||
return Error::from_windows_error(GetLastError());
|
||||
return Error::from_windows_error();
|
||||
|
||||
CloseHandle(process_info.hThread);
|
||||
|
||||
|
@ -108,7 +108,7 @@ ErrorOr<String> Process::get_name()
|
|||
|
||||
DWORD length = GetModuleFileNameW(NULL, path, MAX_PATH);
|
||||
if (!length)
|
||||
return Error::from_windows_error(GetLastError());
|
||||
return Error::from_windows_error();
|
||||
|
||||
return String::from_utf16(Utf16View { { (u16*)path, length } });
|
||||
}
|
||||
|
@ -150,11 +150,11 @@ ErrorOr<int> Process::wait_for_termination()
|
|||
{
|
||||
auto result = WaitForSingleObject(m_handle, INFINITE);
|
||||
if (result == WAIT_FAILED)
|
||||
return Error::from_windows_error(GetLastError());
|
||||
return Error::from_windows_error();
|
||||
|
||||
DWORD exit_code = 0;
|
||||
if (!GetExitCodeProcess(m_handle, &exit_code))
|
||||
return Error::from_windows_error(GetLastError());
|
||||
return Error::from_windows_error();
|
||||
|
||||
return exit_code;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue