Skip to content

Commit d38cb3e

Browse files
committed
[roc-cleanup] Print ret value on command failure
1 parent 76b5b4c commit d38cb3e

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/CommandLineUtilities/ProgramCleanup.cxx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,21 @@ class ProgramCleanup : public Program
7373
Pda::freePdaDmaBuffers();
7474

7575
std::cout << "Removing CRORC FIFO shared memory files" << std::endl;
76-
sysIgnored("rm /dev/shm/AliceO2_RoC_*");
76+
sysCheckRet("rm /dev/shm/AliceO2_RoC_*");
7777
std::cout << "Removing readout 2MB hugepage mappings" << std::endl;
78-
sysIgnored("rm /var/lib/hugetlbfs/global/pagesize-2MB/readout*");
78+
sysCheckRet("rm /var/lib/hugetlbfs/global/pagesize-2MB/readout*");
7979
std::cout << "Removing readout 1GB hugepage mappings" << std::endl;
80-
sysIgnored("rm /var/lib/hugetlbfs/global/pagesize-1GB/readout*");
80+
sysCheckRet("rm /var/lib/hugetlbfs/global/pagesize-1GB/readout*");
8181
std::cout << "Removing roc-bench-dma 2MB hugepage mappings" << std::endl;
82-
sysIgnored("rm /var/lib/hugetlbfs/global/pagesize-2MB/roc-bench-dma*");
82+
sysCheckRet("rm /var/lib/hugetlbfs/global/pagesize-2MB/roc-bench-dma*");
8383
std::cout << "Removing roc-bench-dma 1GB hugepage mappings" << std::endl;
84-
sysIgnored("rm /var/lib/hugetlbfs/global/pagesize-1GB/roc-bench-dma*");
84+
sysCheckRet("rm /var/lib/hugetlbfs/global/pagesize-1GB/roc-bench-dma*");
8585

8686
if (!mOptions.light) {
8787
std::cout << "Removing uio_pci_dma" << std::endl;
88-
sysIgnored("modprobe -r uio_pci_dma");
88+
sysCheckRet("modprobe -r uio_pci_dma");
8989
std::cout << "Reinserting uio_pci_dma" << std::endl;
90-
sysIgnored("modprobe uio_pci_dma");
90+
sysCheckRet("modprobe uio_pci_dma");
9191
}
9292
}
9393

@@ -96,10 +96,12 @@ class ProgramCleanup : public Program
9696
bool light = false;
9797
} mOptions;
9898

99-
// Ignore system()'s return value
100-
void sysIgnored(const char* command)
99+
void sysCheckRet(const char* command)
101100
{
102-
static_cast<void>(system(command));
101+
int ret = system(command);
102+
if (ret) {
103+
std::cerr << "Command: `" << command << "` failed with ret=" << ret << std::endl;
104+
}
103105
}
104106
};
105107

0 commit comments

Comments
 (0)