ecore - efl exe - use better exit codes
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>
Mon, 26 Mar 2018 12:07:46 +0000 (21:07 +0900)
committerWonki Kim <wonki_.kim@samsung.com>
Tue, 10 Apr 2018 11:22:03 +0000 (20:22 +0900)
127 is the "command not found" shell exeit code, 126 is "the command
file is found but is not executable" which i think i'd interpret not
just for execute permissions but that something is preventing it from
executing in general.

src/lib/ecore/efl_exe.c

index 01e7497..73fd264 100644 (file)
@@ -511,9 +511,9 @@ _efl_exe_efl_task_run(Eo *obj EINA_UNUSED, Efl_Exe_Data *pd)
         close(devnull);
      }
 
-   if (!(loop = efl_provider_find(obj, EFL_LOOP_CLASS))) exit(-120);
+   if (!(loop = efl_provider_find(obj, EFL_LOOP_CLASS))) exit(1);
 
-   if (!(tdl = efl_data_scope_get(loop, EFL_TASK_CLASS))) exit(-121);
+   if (!(tdl = efl_data_scope_get(loop, EFL_TASK_CLASS))) exit(1);
 
    // clear systemd notify socket... only relevant for systemd world,
    // otherwise shouldn't be trouble
@@ -533,7 +533,10 @@ _efl_exe_efl_task_run(Eo *obj EINA_UNUSED, Efl_Exe_Data *pd)
    // actually execute!
    _exec(cmd, pd->flags);
    // we couldn't exec... uh oh. HAAAAAAAALP!
-   exit(-122);
+   if ((errno == EACCES)  || (errno == EINVAL) || (errno == ELOOP) ||
+       (errno == ENOEXEC) || (errno == ENOMEM))
+     exit(126);
+   exit(127);
    return NULL;
 #endif
 }