代码拉取完成,页面将自动刷新
//
// NSTask-execute.swift
// AppSigner
//
// Created by Daniel Radtke on 11/3/15.
// Copyright © 2015 Daniel Radtke. All rights reserved.
//
import Foundation
struct AppSignerTaskOutput {
var output: String
var status: Int32
init(status: Int32, output: String){
self.status = status
self.output = output
}
}
extension Process {
func launchSyncronous() -> AppSignerTaskOutput {
self.standardInput = FileHandle.nullDevice
let pipe = Pipe()
self.standardOutput = pipe
self.standardError = pipe
let pipeFile = pipe.fileHandleForReading
self.launch()
let data = NSMutableData()
while self.isRunning {
data.append(pipeFile.availableData)
}
pipeFile.closeFile();
self.terminate();
let output = NSString(data: data as Data, encoding: String.Encoding.utf8.rawValue) as! String
return AppSignerTaskOutput(status: self.terminationStatus, output: output)
}
func execute(_ launchPath: String, workingDirectory: String?, arguments: [String]?)->AppSignerTaskOutput{
self.launchPath = launchPath
if arguments != nil {
self.arguments = arguments
}
if workingDirectory != nil {
self.currentDirectoryPath = workingDirectory!
}
return self.launchSyncronous()
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。