title: Error passing NSString argument to NSTask
body: <p>I am trying to schedule a shutdown event with <code>pmset</code> executed via <code>NSTask</code> in OSX app.</p>
  
  <pre><code> NSCalendar *cal = [NSCalendar new];
  NSDate *dateNext = [date dateByAddingTimeInterval:120];
  
  NSDateFormatter *df = [[NSDateFormatter alloc] init];
  [df setDateFormat:@"MM/dd/YYYY HH:mm:ss"];
  NSString* dS = [df stringFromDate:dateNext];
  
  //# pmset schedule shutdown "MM/DD/YYYY HH:MM:SS"
  
  NSString* dateString = [NSString stringWithFormat:@"\"%@\"", dS];
  NSLog(@"Date to set %@", dateString);
  
  int pid = [[NSProcessInfo processInfo] processIdentifier];
  NSPipe *pipe = [NSPipe pipe];
  NSFileHandle *file = pipe.fileHandleForReading;
  NSTask *task = [[NSTask alloc] init];
  task.launchPath = @"/usr/bin/pmset";
  NSArray *args = [NSArray arrayWithObjects:@"schedule",@"shutdown", dateString, nil];
  
  [task setArguments:args];
  task.standardOutput = pipe;
  [task launch];
  
  NSData *data = [file readDataToEndOfFile];
  [file closeFile];
  
  NSString *out = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding];
  NSLog (@"Result:\n%@", out);
  </code></pre>
  
  <p>The log shows as follows:</p>
  
  <pre><code>2019-09-12 12:38:53.470793+0100 TheApp[51008:4925389] Date to set "09/12/2019 12:40:53"
  2019-09-12 12:38:53.518372+0100 TheApp[51008:4925389] Result:
  Error: Badly formatted date (2)
  Error parsing scheduled event.
  </code></pre>
  
  <p>The <code>dateString</code> argument seems to be correctly formatted between quotes, as required by <code>pmset</code>, but I keep getting such error. Is there some parameter missing in <code>NSTask</code>? </p>
  
  <p>Thank you.</p>