Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

253
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!