• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by John Dev


29 Nov, 2024

Updated at 12 Dec, 2024

My command execution put to the background

Context : I'm developing tests for a java program.

I have a shell script that links java code and interpret it.

In another folder, I wanted to execute this script with the Command struct, and with the currrent_dir function.

When I try my code, the shell script seems to work well, however at a moment of the execution, the execution is automatically put to the background but I don't know why.

I don't want the execution to be put to the background, would someone know how to stop this automatic behaviour ?

(Also when I use the --show-output option of cargo test, it doesn't work.)

Here the part of my code causing the background mode activated for the Command execution :

let output = Command::new("/usr/bin/bash")
                         .current_dir("/home/admin/Desktop/work/dev")
                         .args(["-ic", ProgExeAlias])
                         .output()
                         .expect("ERROR on executing the bash alias for\
                                 executing the program.");

Thanks.

1 post - 1 participant

Read full topic