I have this method:

Qt Code:
  1. void MainWindow::shutdown()
  2. {
  3. //::gpioWrite(ENA_12V,PI_LOW);
  4. QProcess process;
  5. qDebug() << "Powering down the rpi" ;
  6. process.startDetached("sudo systemctl poweroff --no-block");
  7. }
To copy to clipboard, switch view to plain text mode 

It's running on an RPI (Bookworm 64 bit OS). The pi doesn't shutdown.

If I run

Qt Code:
  1. sudo systemctl poweroff --no-block
To copy to clipboard, switch view to plain text mode 

the rpi shuts down as expected.

Why doesn't it work as a QProcess?