commit 574c9a7084f05f979149e4b73d811f7f203be662
parent 3114f8d8d0854676bb6ef3a6677c66211fab3bb7
Author: Joris Vink <joris@coders.se>
Date: Thu, 13 Jun 2019 11:18:10 +0200
make sure kodev run works in python modules.
Diffstat:
1 file changed, 22 insertions(+), 0 deletions(-)
diff --git a/src/cli.c b/src/cli.c
@@ -140,6 +140,7 @@ static void fatal(const char *, ...) __attribute__((noreturn));
static void cli_file_close(int);
static void cli_run_kore(void);
+static void cli_run_kore_python(void);
static void cli_generate_certs(void);
static void cli_compile_kore(void *);
static void cli_link_application(void *);
@@ -747,6 +748,11 @@ cli_clean(int argc, char **argv)
static void
cli_run(int argc, char **argv)
{
+ if (cli_file_exists("__init__.py")) {
+ cli_run_kore_python();
+ return;
+ }
+
run_after = 1;
cli_build(argc, argv);
@@ -1535,6 +1541,22 @@ cli_compile_kore(void *arg)
}
static void
+cli_run_kore_python(void)
+{
+ char *args[3], *cmd;
+
+ (void)cli_vasprintf(&cmd, "%s/bin/kore", prefix);
+
+ args[0] = cmd;
+ args[1] = "-frn";
+ args[2] = NULL;
+
+ execvp(args[0], args);
+ fatal("failed to start '%s': %s", args[0], errno_s);
+
+}
+
+static void
cli_run_kore(void)
{
struct buildopt *bopt;