Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

230
Vistas
why the output file is empty?

I want to redirect the time data into file,I use the child_process to execute shell script the code as follow:

var timeAspCommand = "{ time clingo" + " " +programParam + " " + dataParam +" 2> clingo_sterr ; } 2> /root/output/output_clingo.txt"

let timeAspChildProcess = exec(timeAspCommand, function ( error, stdout, stderr){
          cb(null,stdout)
});

the output/stdout is :

clingo version 5.4.0
Reading from ...ngo/clingoProgram/borda_asp_program.lp ...
Solving...
Answer: 1
borda_win(2) borda_score(1,-286) borda_score(2,382) borda_score(3,88) borda_score(4,-292) borda_score(5,108)
SATISFIABLE

Models       : 1
Calls        : 1
Time         : 0.002s (Solving: 0.00s 1st Model: 0.00s Unsat: 0.00s)
CPU Time     : 0.002s

I expect the content of output_clingo.txt is :

real    0m0.005s
user    0m0.005s
sys 0m0.000s

after that, however, I imput the shell script :

cat/root/output/output_clingo.txt,there is nothing to show .

here is what I have tried :

I just input the command line:

{ time clingo /root/clingo/clingoProgram/borda_asp_program.lp /root/clingo/clingoProgram/borda_asp_dataform.txt 2> clingo_sterr ; } 2> /root/output/output_clingo.txt

then I check the content of the output_clingo.txt by

cat/root/output/output_clingo.txt

and I get :

real    0m0.005s
user    0m0.005s
sys 0m0.000s

this is just what I expect!!! however,when I use the child_process to execute the same shell script , I can't make the content into the output file.

what should I solve this problem?

thanx!

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda