Cannot get output from cm during boot

#1

Hello,

I’d like get output from cm command in an application launched on boot but I get nothing.

I use the following code:

do {
	sleep(10);
	/* Open the command for reading. */
	fp = popen("cm info fsn", "r");
	if (fp == NULL) {
		syslog(LOG_ERR,"Failed to run command\n" );
		exit(-1);
	}

	fgets(result, sizeof(result), fp);
	trimmed = trim(result);
	syslog(LOG_NOTICE,"cm info fsn result %s\n", trimmed);
	/* close */
	pclose(fp);
} while ((strstr(trimmed, "LL") == NULL) && (check++ < 5));

And so, I didn’t get anything in result.
Here I try with cm info fsn but the problem is the same for any other cm command in fact.
But if I replace cm info fsn by date , I do read the output of date.

I have this problem only if the application is started from the init script and even if the cm command is invoked long time after boot up.

If I start the aplication manually from bash, it’s OK.
Any idea?

#2

Please try using the fully qualified path to cm “/legato/systems/current/bin/cm”