Quellcodebibliothek Statistik Leitseite products/sources/formale Sprachen/C/Firefox/toolkit/xre/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 925 B image not shown  

Quelle  MacUtils.mm   Sprache: unbekannt

 
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "MacAutoreleasePool.h"
#include "MacUtils.h"

namespace mozilla::MacUtils {

/**
 * Helper to launch macOS tasks via NSTask and wait for the launched task to
 * terminate.
 */
void LaunchTask(NSString* aPath, NSArray* aArguments) {
  MacAutoreleasePool pool;

  @try {
    NSTask* task = [[NSTask alloc] init];
    [task setExecutableURL:[NSURL fileURLWithPath:aPath]];
    if (aArguments) {
      [task setArguments:aArguments];
    }
    [task launchAndReturnError:nil];
    [task waitUntilExit];
    [task release];
  } @catch (NSException* e) {
    NSLog(@"%@: %@", e.name, e.reason);
  }
}

}  // namespace mozilla::MacUtils

[ Dauer der Verarbeitung: 0.14 Sekunden  (vorverarbeitet)  ]