0
외부 파일을 통해 나는 스위프트 스크립트가 있습니다 스위프트 스크립트는 엑스 코드 스크립트 실행 단계 내에서 직접 작동,하지만 인해 NSTask/프로세스
#!/usr/bin/env xcrun --sdk macosx swift
import Foundation
let task = Process()
// other stuff
Process()
Process()
을 제거하면 작동합니다.
또한 스크립트 실행 단계에 Swift 코드를 직접 붙여 넣고 쉘 필드를 /usr/bin/env xcrun --sdk macosx swift
으로 설정하면 Process()
을 포함하여 작동합니다.
외부 파일을 통해 어떻게 작동합니까?
오류 출력은 :
<unknown>:0: warning: using sysroot for 'iPhoneSimulator' but targeting 'MacOSX'
0 swift 0x000000010497b3ad PrintStackTraceSignalHandler(void*) + 45
1 swift 0x000000010497ab56 SignalHandler(int) + 790
2 libsystem_platform.dylib 0x00007fffdd51cbba _sigtramp + 26
3 libsystem_platform.dylib 0x00007fff5e2df650 _sigtramp + 2161912496
4 swift 0x0000000101f87996 swift::ModuleFile::getType(llvm::PointerEmbeddedInt<unsigned int, 31>) + 806
5 swift 0x0000000101f80178 swift::ModuleFile::getDecl(llvm::PointerEmbeddedInt<unsigned int, 31>, llvm::Optional<swift::DeclContext*>) + 18664
6 swift 0x0000000102006ec1 swift::SerializedASTFile::lookupVisibleDecls(llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, swift::VisibleDeclConsumer&, swift::NLKind) const + 929
7 swift 0x00000001023c7d75 void lookupInModule<llvm::DenseMap<swift::Identifier, std::__1::pair<swift::namelookup::ResolutionKind, llvm::SmallSet<swift::CanType, 4u, (anonymous namespace)::SortCanType> >, llvm::DenseMapInfo<swift::Identifier>, llvm::detail::DenseMapPair<swift::Identifier, std::__1::pair<swift::namelookup::ResolutionKind, llvm::SmallSet<swift::CanType, 4u, (anonymous namespace)::SortCanType> > > >, swift::namelookup::lookupVisibleDeclsInModule(swift::ModuleDecl*, llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, llvm::SmallVectorImpl<swift::ValueDecl*>&, swift::NLKind, swift::namelookup::ResolutionKind, swift::LazyResolver*, swift::DeclContext const*, llvm::ArrayRef<std::__1::pair<llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*> >)::$_1>(swift::ModuleDecl*, llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, llvm::SmallVectorImpl<swift::ValueDecl*>&, swift::namelookup::ResolutionKind, bool, swift::LazyResolver*, llvm::SmallDenseMap<std::__1::pair<llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*>, llvm::TinyPtrVector<swift::ValueDecl*>, 32u, llvm::DenseMapInfo<std::__1::pair<llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*> >, llvm::detail::DenseMapPair<std::__1::pair<llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*>, llvm::TinyPtrVector<swift::ValueDecl*> > >&, swift::DeclContext const*, bool, llvm::ArrayRef<std::__1::pair<llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*> >, swift::namelookup::lookupVisibleDeclsInModule(swift::ModuleDecl*, llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, llvm::SmallVectorImpl<swift::ValueDecl*>&, swift::NLKind, swift::namelookup::ResolutionKind, swift::LazyResolver*, swift::DeclContext const*, llvm::ArrayRef<std::__1::pair<llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*> >)::$_1) + 325
8 swift 0x00000001023c835b void lookupInModule<llvm::DenseMap<swift::Identifier, std::__1::pair<swift::namelookup::ResolutionKind, llvm::SmallSet<swift::CanType, 4u, (anonymous namespace)::SortCanType> >, llvm::DenseMapInfo<swift::Identifier>, llvm::detail::DenseMapPair<swift::Identifier, std::__1::pair<swift::namelookup::ResolutionKind, llvm::SmallSet<swift::CanType, 4u, (anonymous namespace)::SortCanType> > > >, swift::namelookup::lookupVisibleDeclsInModule(swift::ModuleDecl*, llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, llvm::SmallVectorImpl<swift::ValueDecl*>&, swift::NLKind, swift::namelookup::ResolutionKind, swift::LazyResolver*, swift::DeclContext const*, llvm::ArrayRef<std::__1::pair<llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*> >)::$_1>(swift::ModuleDecl*, llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, llvm::SmallVectorImpl<swift::ValueDecl*>&, swift::namelookup::ResolutionKind, bool, swift::LazyResolver*, llvm::SmallDenseMap<std::__1::pair<llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*>, llvm::TinyPtrVector<swift::ValueDecl*>, 32u, llvm::DenseMapInfo<std::__1::pair<llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*> >, llvm::detail::DenseMapPair<std::__1::pair<llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*>, llvm::TinyPtrVector<swift::ValueDecl*> > >&, swift::DeclContext const*, bool, llvm::ArrayRef<std::__1::pair<llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*> >, swift::namelookup::lookupVisibleDeclsInModule(swift::ModuleDecl*, llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, llvm::SmallVectorImpl<swift::ValueDecl*>&, swift::NLKind, swift::namelookup::ResolutionKind, swift::LazyResolver*, swift::DeclContext const*, llvm::ArrayRef<std::__1::pair<llvm::ArrayRef<std::__1::pair<swift::Identifier, swift::SourceLoc> >, swift::ModuleDecl*> >)::$_1) + 1835
9 swift 0x00000001023adcf5 swift::lookupVisibleDecls(swift::VisibleDeclConsumer&, swift::DeclContext const*, swift::LazyResolver*, bool, swift::SourceLoc) + 4053
10 swift 0x0000000102277092 swift::TypeChecker::performTypoCorrection(swift::DeclContext*, swift::DeclRefKind, swift::Type, swift::DeclName, swift::SourceLoc, swift::OptionSet<swift::NameLookupFlags, unsigned int>, swift::LookupResult&, unsigned int) + 354
11 swift 0x000000010221a50b swift::TypeChecker::resolveDeclRefExpr(swift::UnresolvedDeclRefExpr*, swift::DeclContext*) + 2091
12 swift 0x000000010221dbc3 (anonymous namespace)::PreCheckExpression::walkToExprPre(swift::Expr*) + 1283
13 swift 0x000000010232289e (anonymous namespace)::Traversal::visitApplyExpr(swift::ApplyExpr*) + 30
14 swift 0x000000010231eabb (anonymous namespace)::Traversal::visit(swift::Expr*) + 203
15 swift 0x000000010221d374 swift::TypeChecker::solveForExpression(swift::Expr*&, swift::DeclContext*, swift::Type, swift::FreeTypeVariableBinding, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem&, llvm::SmallVectorImpl<swift::constraints::Solution>&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 244
16 swift 0x000000010221fa56 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) + 630
17 swift 0x000000010222227c swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*) + 300
18 swift 0x0000000102222bdf swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int) + 527
19 swift 0x0000000102239d7d validatePatternBindingDecl(swift::TypeChecker&, swift::PatternBindingDecl*, unsigned int) + 1197
20 swift 0x000000010222f70e (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 366
21 swift 0x000000010224c3c4 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 180
22 swift 0x00000001022a2769 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 425
23 swift 0x00000001022a69bc swift::TypeChecker::typeCheckTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 188
24 swift 0x0000000102258018 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) + 1848
25 swift 0x0000000101efe96f swift::CompilerInstance::performSema() + 5231
26 swift 0x0000000101983cf5 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 2725
27 swift 0x00000001019812b3 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 17859
28 swift 0x000000010193d5cf main + 8239
29 libdyld.dylib 0x00007fffdd30f255 start + 1
30 libdyld.dylib 0x000000000000000b start + 583994807
Stack dump:
0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -interpret /Users/project_dir/scripts/pre-tests.swift -target x86_64-apple-macosx10.9 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk -module-name main
1. While type-checking declaration 0x7ff873019c38 at /Users/project_dir/scripts/pre-tests.swift:4:1
2. While type-checking expression at [/Users/project_dir/scripts/pre-tests.swift:4:12 - line:4:20] RangeText="Process()"
3. While reading from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/x86_64/Foundation.swiftmodule
4. While deserializing decl #676 (VAR_DECL)
/Users/sundeep/Library/Developer/Xcode/DerivedData/app-heynlarouefyakbanugsnjohqyis/Build/Intermediates/appCore.build/Debug-iphonesimulator/appCore iOS.build/Script-AE60724E1E706D7900A68C91.sh: line 2: 21571 Segmentation fault: 11 swift "${PROJECT_DIR}/scripts/pre-tests.swift"
Command /bin/sh failed with exit code 139