summaryrefslogtreecommitdiff
path: root/Userland/Games/Chess
diff options
context:
space:
mode:
authorBen Wiederhake <BenWiederhake.GitHub@gmx.de>2023-05-07 00:53:19 +0200
committerJelle Raaijmakers <jelle@gmta.nl>2023-05-07 14:04:55 +0200
commit0fe29a48ad85ed592b81b77cdd51a0cddbce6c44 (patch)
tree1fce1649efbb02b838760d24a0bf501a613ba3d4 /Userland/Games/Chess
parent715f4a8d7e159c8874c314db5dbbe6d123d3d2cf (diff)
downloadserenity-0fe29a48ad85ed592b81b77cdd51a0cddbce6c44.zip
Chess: Avoid IODevice and DeprecatedFile
Diffstat (limited to 'Userland/Games/Chess')
-rw-r--r--Userland/Games/Chess/Engine.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/Userland/Games/Chess/Engine.cpp b/Userland/Games/Chess/Engine.cpp
index 83825e7d6c..b70b83169d 100644
--- a/Userland/Games/Chess/Engine.cpp
+++ b/Userland/Games/Chess/Engine.cpp
@@ -6,7 +6,7 @@
*/
#include "Engine.h"
-#include <LibCore/DeprecatedFile.h>
+#include <LibCore/File.h>
#include <fcntl.h>
#include <spawn.h>
#include <stdio.h>
@@ -27,12 +27,12 @@ void Engine::connect_to_engine_service()
{
int wpipefds[2];
int rpipefds[2];
- if (pipe2(wpipefds, O_CLOEXEC) < 0) {
+ if (pipe2(wpipefds, O_CLOEXEC | O_NONBLOCK) < 0) {
perror("pipe2");
VERIFY_NOT_REACHED();
}
- if (pipe2(rpipefds, O_CLOEXEC) < 0) {
+ if (pipe2(rpipefds, O_CLOEXEC | O_NONBLOCK) < 0) {
perror("pipe2");
VERIFY_NOT_REACHED();
}
@@ -54,13 +54,11 @@ void Engine::connect_to_engine_service()
close(wpipefds[0]);
close(rpipefds[1]);
- auto infile = Core::DeprecatedFile::construct();
- infile->open(rpipefds[0], Core::OpenMode::ReadOnly, Core::DeprecatedFile::ShouldCloseFileDescriptor::Yes);
- set_in(infile);
+ auto infile = Core::File::adopt_fd(rpipefds[0], Core::File::OpenMode::Read).release_value_but_fixme_should_propagate_errors();
+ set_in(move(infile));
- auto outfile = Core::DeprecatedFile::construct();
- outfile->open(wpipefds[1], Core::OpenMode::WriteOnly, Core::DeprecatedFile::ShouldCloseFileDescriptor::Yes);
- set_out(outfile);
+ auto outfile = Core::File::adopt_fd(wpipefds[1], Core::File::OpenMode::Write).release_value_but_fixme_should_propagate_errors();
+ set_out(move(outfile));
send_command(Chess::UCI::UCICommand());
m_connected = true;