Skip to content

Commit

Permalink
Merge pull request #577 from Farama-Foundation/noxserver-mac
Browse files Browse the repository at this point in the history
Add support for viz_noxserver on macos
  • Loading branch information
mwydmuch authored Dec 15, 2023
2 parents 2a073fc + 7ebfb60 commit 08f1c9f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ jobs:
path: dist/*.tar.gz

upload_pypi:
name: Upload to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment: pypi
Expand Down
6 changes: 3 additions & 3 deletions src/lib/ViZDoomController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ namespace vizdoom {

this->MQDoom->send(MSG_CODE_CLOSE);

#ifdef OS_LINUX
#ifdef OS_POSIX
if(0 == kill(this->doomProcessPid, 0)){
bpr::child doomProcess(this->doomProcessPid);
bpr::terminate(doomProcess);
Expand Down Expand Up @@ -1415,7 +1415,7 @@ namespace vizdoom {
this->doomArgs.push_back("+viz_window_hidden");
this->doomArgs.push_back("1");

#ifdef OS_LINUX
#ifdef OS_POSIX
if (this->noXServer){
this->doomArgs.push_back("+viz_noxserver");
this->doomArgs.push_back("1");
Expand Down Expand Up @@ -1464,7 +1464,7 @@ namespace vizdoom {
void DoomController::launchDoom() {
try {
bpr::child doomProcess = bpr::execute(bpri::set_args(this->doomArgs), bpri::inherit_env());
#ifdef OS_LINUX
#ifdef OS_POSIX
this->doomProcessPid = doomProcess.pid;
#endif
bpr::wait_for_exit(doomProcess);
Expand Down
6 changes: 5 additions & 1 deletion src/lib/ViZDoomController.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,16 @@ namespace vizdoom {
/* OSes */
#ifdef __linux__
#define OS_LINUX
#define OS_POSIX
#include <sys/types.h>
#include <signal.h>
#elif _WIN32
#define OS_WIN
#elif __APPLE__
#define OS_OSX
#define OS_POSIX
#include <sys/types.h>
#include <signal.h>
#endif

class DoomController {
Expand Down Expand Up @@ -329,7 +333,7 @@ namespace vizdoom {

b::thread *doomThread;

#ifdef OS_LINUX
#ifdef OS_POSIX
pid_t doomProcessPid;
#endif

Expand Down

0 comments on commit 08f1c9f

Please sign in to comment.