Skip to content

Commit

Permalink
Fixes the setproctitle bug, and the wheel bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
mariano54 authored and richardkiss committed Mar 10, 2020
1 parent 9bd5646 commit fb4641d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/spt_python.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
#include <Python.h>

/* Things change a lot here... */
#if PY_MAJOR_VERSION >= 3
#define IS_PY3K
#endif

/* Detect pypy */
#ifdef PYPY_VERSION
Expand Down
22 changes: 21 additions & 1 deletion src/spt_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,14 @@ get_args_from_proc(int *argc_o, char **arg0_o)
return rv;
}

static int getargcargv(int* argc, char*** argv) {
#ifdef __APPLE__

return 0;
#endif
return -1;
}

/* Find the original arg buffer, return 0 if found, else -1.
*
* If found, set argc to the number of arguments, argv to an array
Expand All @@ -369,8 +377,10 @@ get_argc_argv(int *argc_o, char ***argv_o)
int rv = -1;

#ifndef IS_PYPY
#ifndef __APPLE__
spt_debug("reading argc/argv from Python main");
Py_GetArgcArgv(&argc, &argv_py);
#endif
#endif

if (argc > 0) {
Expand All @@ -397,8 +407,18 @@ get_argc_argv(int *argc_o, char ***argv_o)
/* get a copy of argv[0] from /proc, so we get back in the same
* situation of Py3 */
if (0 > get_args_from_proc(&argc, &arg0)) {
spt_debug("reading argc/argv from Python main");
#ifdef __APPLE__
argv = *_NSGetArgv();
argc = *_NSGetArgc();
if (argc == 0) {
spt_debug("failed to get args from proc fs");
goto exit;
}
#else
spt_debug("failed to get args from proc fs");
goto exit;
#endif
}
}

Expand Down Expand Up @@ -447,7 +467,7 @@ spt_setup(void)
#ifndef WIN32
int argc = 0;
char **argv = NULL;
char *init_title;
char *init_title = "chia";

if (0 > get_argc_argv(&argc, &argv)) {
spt_debug("get_argc_argv failed");
Expand Down

0 comments on commit fb4641d

Please sign in to comment.