Kare Morstol
78e582d3d6
Add link to Swift 4 version.
2017-09-23 01:05:50 +02:00
Kare Morstol
8518bcfbb0
Readme: add instructions for Marathon, and more badges.
2017-05-16 00:43:22 +02:00
Kare Morstol
433f281166
swiftshell-init use version 3.0.0, not the beta.
3.0.1
2017-05-11 21:43:14 +02:00
Kare Morstol
ae127df8c5
Remove Scripts directory reference in XCode.
2017-05-11 21:41:58 +02:00
Kare Morstol
93964b518f
Improve error output from ‘exit’ and non-SwiftShell errors.
2017-04-28 21:43:42 +02:00
Kare Morstol
cdb243acd5
Release SwiftShell 3.0.
...
At long last.
3.0.0
2017-04-28 19:12:46 +02:00
Kare Morstol
dcd6f2d53a
Fix the fixing of the Linux fix.
2017-04-28 01:32:19 +02:00
Kare Morstol
a5d4555d50
Readme: small-ish changes.
2017-04-28 00:52:56 +02:00
Kare Morstol
adcb0a09fa
Streams: add support for writing and reading Data.
2017-04-27 23:53:05 +02:00
Kare Morstol
f3bfbeb524
Make sure writing a stream to another stream compiles.
...
Because it very easily does not.
2017-04-27 23:53:05 +02:00
Kare Morstol
37464adb24
Mark closures to ReadableStream.onOutput and .onStringOutput as @escaping.
...
And non-optional.
2017-04-27 23:52:28 +02:00
Kare Morstol
2719f55162
Add AsyncCommand.isRunning.
...
Implement strangely missing stuff on Linux.
2017-04-27 23:52:28 +02:00
Kare Morstol
911df7e7ac
Mark AsyncCommand.onCompletion parameter as @escaping and non-optional.
2017-04-27 17:32:23 +02:00
Kare Morstol
8c45703aed
Readme: add Table of Contents, remove “Overview” heading.
2017-04-27 17:05:56 +02:00
Kare Morstol
f7a8c7cd88
Remove Script directory as it is outdated.
...
May be updated and turned into unit tests later.
2017-04-27 17:05:56 +02:00
Kare Morstol
e789bec019
Readme: massive improvements, especially for Contexts and Streams. ( #40 )
...
* reorganise and update. Add logo.
* center logo.
GitHub does not seem to allow it to float to the right.
* Example for Context, start to describe Streams.
* Finish with streams.
* Finish section on Commands.
2017-04-27 03:10:12 +02:00
Kare Morstol
7aefeb6a7a
Fix Linux build crash "Can only convert lvalues to inout".
...
Now I vaguely recall it was there for a reason.
```
$ swift build
Compile Swift Module 'SwiftShell' (9 sources)
swift: /home/buildnode/disk2/workspace/oss-swift-3.1-package-linux-ubuntu-14_04/swift/lib/Sema/CSApply.cpp:5990: swift::Expr *(anonymous namespace)::ExprRewriter::coerceObjectArgumentToType(swift::Expr *, swift::Type, swift::ValueDecl *, swift::AccessSemantics, swift::constraints::ConstraintLocatorBuilder): Assertion `fromType->is<LValueType>() && "Can only convert lvalues to inout"' failed.
#0 0x000000000335ffe8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x335ffe8)
#1 0x0000000003360b86 SignalHandler(int) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x3360b86)
#2 0x00007f239201c330 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#3 0x00007f2390a07c37 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x36c37)
#4 0x00007f2390a0b028 abort (/lib/x86_64-linux-gnu/libc.so.6+0x3a028)
#5 0x00007f2390a00bf6 (/lib/x86_64-linux-gnu/libc.so.6+0x2fbf6)
#6 0x00007f2390a00ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#7 0x00000000010a306a (anonymous namespace)::ExprRewriter::coerceObjectArgumentToType(swift::Expr*, swift::Type, swift::ValueDecl*, swift::AccessSemantics, swift::constraints::ConstraintLocatorBuilder) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x10a306a)
#8 0x000000000109b0cc (anonymous namespace)::ExprRewriter::buildMemberRef(swift::Expr*, swift::Type, swift::SourceLoc, swift::ValueDecl*, swift::DeclNameLoc, swift::Type, swift::constraints::ConstraintLocatorBuilder, swift::constraints::ConstraintLocatorBuilder, bool, swift::FunctionRefKind, swift::AccessSemantics, bool) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x109b0cc)
#9 0x00000000010a8c3f swift::ASTVisitor<(anonymous namespace)::ExprRewriter, swift::Expr*, void, void, void, void, void>::visit(swift::Expr*) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x10a8c3f)
#10 0x0000000001099314 (anonymous namespace)::ExprRewriter::walkToExprPost(swift::Expr*) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x1099314)
#11 0x00000000010b11b1 (anonymous namespace)::ExprWalker::walkToExprPost(swift::Expr*) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x10b11b1)
#12 0x000000000128901c (anonymous namespace)::Traversal::visitApplyExpr(swift::ApplyExpr*) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x128901c)
#13 0x000000000128303b swift::Expr::walk(swift::ASTWalker&) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x128303b)
#14 0x00000000010960f2 swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::Expr*, swift::Type, bool, bool, bool) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x10960f2)
#15 0x00000000011604ff swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::TypeLoc, swift::ContextualTypePurpose, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>, swift::ExprTypeCheckListener*, swift::constraints::ConstraintSystem*) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x11604ff)
#16 0x000000000107af20 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x107af20)
#17 0x000000000107b219 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x107b219)
#18 0x000000000107ae4c swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x107ae4c)
#19 0x0000000001079ad5 (anonymous namespace)::StmtChecker::typeCheckBody(swift::BraceStmt*&) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x1079ad5)
#20 0x0000000001078dad swift::TypeChecker::typeCheckFunctionBodyUntil(swift::FuncDecl*, swift::SourceLoc) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x1078dad)
#21 0x0000000001078c05 swift::TypeChecker::typeCheckAbstractFunctionBodyUntil(swift::AbstractFunctionDecl*, swift::SourceLoc) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x1078c05)
#22 0x000000000107981c swift::TypeChecker::typeCheckAbstractFunctionBody(swift::AbstractFunctionDecl*) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x107981c)
#23 0x000000000108fc08 typeCheckFunctionsAndExternalDecls(swift::TypeChecker&) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x108fc08)
#24 0x00000000010908a1 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x10908a1)
#25 0x0000000000e0fe4a swift::CompilerInstance::performSema() (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0xe0fe4a)
#26 0x0000000000475eed swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x475eed)
#27 0x000000000043bbe4 main (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x43bbe4)
#28 0x00007f23909f2f45 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21f45)
#29 0x00000000004395a0 _start (/home/travis/.swiftenv/versions/3.1/usr/bin/swift+0x4395a0)
Stack dump:
0. Program arguments: /home/travis/.swiftenv/versions/3.1/usr/bin/swift -frontend -c /home/travis/build/kareman/SwiftShell/Sources/SwiftShell/FileHandle.swift /home/travis/build/kareman/SwiftShell/Sources/SwiftShell/String.swift /home/travis/build/kareman/SwiftShell/Sources/SwiftShell/Bash.swift /home/travis/build/kareman/SwiftShell/Sources/SwiftShell/Context.swift /home/travis/build/kareman/SwiftShell/Sources/SwiftShell/Files.swift /home/travis/build/kareman/SwiftShell/Sources/SwiftShell/Command.swift /home/travis/build/kareman/SwiftShell/Sources/SwiftShell/General/Array.swift -primary-file /home/travis/build/kareman/SwiftShell/Sources/SwiftShell/Stream/Stream.swift /home/travis/build/kareman/SwiftShell/Sources/SwiftShell/Stream/Lazy-split.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -I /home/travis/build/kareman/SwiftShell/.build/debug -enable-testing -g -module-cache-path /home/travis/build/kareman/SwiftShell/.build/debug/ModuleCache -D SWIFT_PACKAGE -emit-module-doc-path /home/travis/build/kareman/SwiftShell/.build/debug/SwiftShell.build/Stream~partial.swiftdoc -Onone -parse-as-library -module-name SwiftShell -emit-module-path /home/travis/build/kareman/SwiftShell/.build/debug/SwiftShell.build/Stream~partial.swiftmodule -emit-dependencies-path /home/travis/build/kareman/SwiftShell/.build/debug/SwiftShell.build/Stream.d -emit-reference-dependencies-path /home/travis/build/kareman/SwiftShell/.build/debug/SwiftShell.build/Stream.swiftdeps -num-threads 8 -o /home/travis/build/kareman/SwiftShell/.build/debug/SwiftShell.build/Stream/Stream.swift.o
1. While type-checking 'write' at /home/travis/build/kareman/SwiftShell/Sources/SwiftShell/Stream/Stream.swift:89:9
2. While type-checking expression at [/home/travis/build/kareman/SwiftShell/Sources/SwiftShell/Stream/Stream.swift:90:38 - line:90:55] RangeText="target.write(text)"
<unknown>:0: error: unable to execute command: Aborted
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
<unknown>:0: error: build had 1 command failures
```
2017-04-27 03:06:02 +02:00
Kare Morstol
f195472d87
Allow ReadableStream.write(to:) to take a WritableStream _protocol value_.
...
As opposed to a generic TextOutputStream value.
Tried to add this unit test:
```swift
func testWriteTo() {
let (writer1,reader1) = streams()
var (writer2,reader2) = streams()
writer1.write("something")
writer1.close()
writer2.write("h")
reader1.write(to: &writer2)
XCTAssertEqual(reader2.read(), "something")
}
but the first `writer2.write` causes an EXC_BAD_ACCESS exception here:
```swift
extension WritableStream {
public func write(_ x: String) {
filehandle.write(x, encoding: encoding)
}
```
No idea why.
2017-04-27 02:18:50 +02:00
Kare Morstol
90230ad725
Rename RunOutput(output:) to RunOutput(launch:).
2017-04-27 01:34:06 +02:00
Kare Morstol
3413a622a2
Un-capitalise enum cases. Future proof switch statement.
2017-04-24 17:54:07 +02:00
Kare Morstol
fdf348859c
Remove space before ( in function declarations.
...
I used to think it looked better for some reason.
2017-04-20 20:32:29 +02:00
Kare Morstol
1fef513b26
Documentation: small fixes.
2017-04-20 19:54:09 +02:00
Kare Morstol
ecc86ad124
Remove horrible hack for printing to stdout.
...
Not needed anymore after StdoutStream is the default for main.stdout.
2017-04-18 19:51:03 +02:00
Kare Morstol
0a078a20a5
Camel case enum cases of CommandError.
2017-04-18 19:07:56 +02:00
Kare Morstol
e7e43b42ba
Cleanup code.
...
With the help of SwiftLint.
2017-04-18 19:05:36 +02:00
Kare Morstol
daee36b00e
Travis: use Xcode 8.3, verify cocoa pod.
2017-04-06 22:31:55 +02:00
Kare Morstol
caea066468
Improve documentation for "run".
3.0.0-beta.14
2017-04-05 18:34:26 +02:00
Kare Morstol
33019fb307
Replace all uses of the word "Task".
...
with "command" or "process".
2017-04-05 18:29:49 +02:00
Kare Morstol
2d61e881ec
Make unavailable run() -> String method signatures identical to the available one
...
Otherwise using 'run' without capturing the output makes Swift think we are trying to run the unavailable ones that return a String.
2017-04-05 18:29:49 +02:00
Kare Morstol
9024477468
Ensure all 'run' functions have 'combineOutput' parameter and none have file and line parameters.
2017-04-05 01:28:50 +02:00
Kare Morstol
c9d75bd68e
Document && and || operators.
2017-04-05 01:28:50 +02:00
Kare Morstol
de0414c6a3
Add String.lines().
2017-04-05 01:28:50 +02:00
Kare Morstol
5f40cb878f
Simplify bash run-functions, add file and line numbers to global runAsync(bash:) function.
2017-04-05 01:28:50 +02:00
Kare Morstol
72dd5d8277
Add combineOutput parameter to 'run'.
2017-04-05 01:28:50 +02:00
Kare Morstol
891422fe7c
Add RunOutput.error. Add file and line params to runAsync(bash:).
2017-04-05 01:28:50 +02:00
Kare Morstol
74077e9b06
Make RunOutput.|| and .&& public. Remove @testable from test imports.
...
The latter to avoid making the same mistake again.
2017-04-03 19:42:53 +02:00
Kare Morstol
38f3d41ca7
Also rename in LinuxMain.swift.
3.0.0-beta.13
2017-03-31 00:08:56 +02:00
Kare Morstol
4d2ed74b55
Massive renaming: avoid words Type, Task and Shell.
...
Protocols should no longer end in Type, Task has been renamed in Foundation and the word Shell is not appropriate for running commands / launching processes, it describes terminal applications and shell interpreters like bash. Which means the name SwiftShell itself is probably a misnomer but I am not about to change that now.
Also remove any mentions of SwiftShell 2.
2017-03-30 20:10:05 +02:00
Kare Morstol
ba403e8bf9
Make main's tempdirectory, arguments and path publicly immutable.
2017-03-30 13:44:15 +02:00
Kare Morstol
00edb93cb8
Auto-implement ShellRunnable for ShellContextType.
2017-03-30 13:42:06 +02:00
Kare Morstol
4cbdea39a7
Remove encoding from ShellContextType, as it has no effect there.
...
But leave it in ‘main’ as it is quite useful as a global variable.
2017-03-29 23:36:17 +02:00
Kare Morstol
bd8ceeecbc
Make RunOutput.stdout and .stderror publicly immutable.
2017-03-29 21:50:27 +02:00
Kare Morstol
85bbe2a009
Update to Swift 3.1. Travis: don't test the beta anymore.
2017-03-29 20:24:09 +02:00
Kare Morstol
755d1aa563
run() returns RunOutput instead of String. Supports || and &&.
2017-03-29 19:59:26 +02:00
Kare Morstol
03adb38f56
Update to Xcode 8.3.
...
Can't update .swift-version to 3.1 yet because of Travis and swiftenv.
2017-03-29 19:11:11 +02:00
Kare Morstol
85962c2da2
Readme: add shebang to example.
2017-03-28 12:45:12 +02:00
Kare Morstol
21a385f198
Simplify #if statement.
3.0.0-beta.12
2017-03-23 20:53:07 +01:00
Kare Morstol
3a824465c8
Travis: test on Swift 3.1 beta
...
Install Swift 3.1 first
2017-03-23 20:53:07 +01:00
Joe Smith
4c416f38a4
Swift 3.1 Correctly Removes Task ( #35 )
...
Looks like this may be fallout from https://bugs.swift.org/browse/SR-3279
2017-03-23 20:37:49 +01:00
Kare Morstol
fee47d0857
Readme: add header for Moderator and FileSmith.
2017-03-16 01:12:49 +01:00