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

255
Vistas
How can we run a node js file form objective-c

I have a macOS project using objective-c. Basically I new to creating application for macOS. I don't not objective-c or swift but I have a nodejs file that I need to run and not sure how to.

#import <Cocoa/Cocoa.h>

int main(int argc, const char *argv[]) {
  
  - (NSString *)runCommand:(NSString *)commandToRun
  {
      NSTask *task = [[NSTask alloc] init];
      [task setLaunchPath:@"/nodefile.js"];

      NSArray *arguments = [NSArray arrayWithObjects:
                            @"-c" ,
                            [NSString stringWithFormat:@"%@", commandToRun],
                            nil];
      NSLog(@"run command:%@", commandToRun);
      [task setArguments:arguments];

      NSPipe *pipe = [NSPipe pipe];
      [task setStandardOutput:pipe];

      NSFileHandle *file = [pipe fileHandleForReading];

      [task launch];

      NSData *data = [file readDataToEndOfFile];

      NSString *output = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
      return output;
  }
  
 
  return NSApplicationMain(argc, argv);
}
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