Open Avispa opened 7 years ago
--- tilda.c.orig 2017-09-17 14:29:53.223379000 +0500
+++ tilda.c 2017-09-17 14:58:33.195631000 +0500
@@ -231,7 +231,7 @@
static GSList *getPids() {
GSList *pids = NULL;
FILE *ps_output;
- const gchar ps_command[] = "ps -C tilda -o pid=";
+ const gchar ps_command[] = "pgrep -a tilda";
gchar buf[16]; /* Really shouldn't need more than 6 */
if ((ps_output = popen (ps_command, "r")) == NULL) {
If we change this, then lets use something that is POSIX compliant and will work on all systems.
How about:
- const gchar ps_command[] = "ps -C tilda -o pid=";
+ const gchar ps_command[] = "ps -Aocomm=,pid=,etime= | "
"sed -ne \"s/^tilda *//p\"";
Without knowing the code or the background of the code but wouldn't it better to just call the appropriate C function than some "funky" programs? (For example: pid_t getpid(void);
.)
@lanoxx, it works in busibox's ash indeed
tilda --help
, and others probably as well -- version for example, shows ps(1) error.PS: A manpage (man(1)) would be neat anyhow.