Skip to content

Invalid PID when trying to kill BackgroundCommand #693

@ep1cman

Description

@ep1cman

I have started a background task as follows:

self._process = self._target.background(f"poller -l {','.join([str(x) for x in self._files.keys()])} {' '.join(self._files.values())}", as_root=self._as_root)

When I then try to run:

self._process.cancel()

I see the following error:

Command '/home/appa/devlib-target/bin/busybox kill -15 -329893' returned non-zero exit status 1.
OUTPUT: kill: can't kill pid -329893: No such process

Checking on the device I can see that the PID does exist:

root      329893  0.0  0.0   2060   500 ?        S    10:44   0:00 sh -c sh -c 'export PATH=/home/appa/devlib-target/bin:$PATH && export LC_ALL=C && poller -l 0 /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq'
root      329894  0.0  0.0   2060   472 ?        S    10:44   0:00 sh -c export PATH=/home/appa/devlib-target/bin:$PATH && export LC_ALL=C && poller -l 0 /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
root      329895  0.0  0.0    936     4 ?        S    10:44   0:00 poller -l 0 /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
appa      330021  0.0  0.0   8576   648 pts/0    S+   10:45   0:00 grep --color=auto poller

It seems the issue is the preceding -, if I run the command manually without it (/home/appa/devlib-target/bin/busybox kill -15 329893) the process is killed as expected

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions