36 Commits

Author SHA1 Message Date
Kare Morstol a1ad3fb25c Reformat code using swiftformat 0.40.14
Because it is the last version that does indentation and alignment correctly (tabs for indentation, spaces for alignment).
2020-07-11 15:33:57 +02:00
Kare Morstol 4729769743 Use built-in XCTest error testing. 2020-07-10 19:38:47 +02:00
Kare Morstol 303dca53a3 Remove Tests/LinuxMain.swift, use '--enable-test-discovery' on Linux instead. 2020-07-10 19:38:47 +02:00
Kare Morstol 45a21f0b5b Remove custom nullDevice.
Turns out my implementation of nullDevice in SwiftFoundation was merged four years ago and I forgot about it.
2020-07-10 19:38:47 +02:00
Kare Morstol b69b6ff877 Make RunOutput.stdout and .stderror publicly immutable again.
For some reason I apparently thought that lazy properties are always immutable. I have no idea why.
2018-10-03 19:17:53 +02:00
Kare Morstol 69eccb6cad Make main.stdout.encoding default to main.encoding. 2018-04-17 23:46:26 +02:00
Kare Morstol c8c07f74c1 Add AsyncCommand.onCompletion override. 2018-04-17 23:37:32 +02:00
Kare Morstol 3959f04359 run: do not read both standard output and standard error if they are the same. 2018-04-10 01:31:03 +02:00
Kare Morstol a2203d76cf Add runAsyncAndPrint command (#61). 2018-04-09 04:40:49 +02:00
Jacob Wlliams 42e7cff534 Fix #60. Add AsyncCommand.stop, interrupt, suspend and resume.
Also for Linux.

* Implement all the missing signal functions available to Process

* stop and interrupt now function nearly-identical to how they should on macOS

* Implemented the suspend and resume functions, cleaned up the stop and interrupt related functionality
2018-03-13 13:06:31 +01:00
Kare Morstol 7ec2e02721 Include all “run” unit tests on Linux. 2018-03-04 16:24:06 +01:00
Kare Morstol fc9ebdd49c "run" – read standard error and standard output simultaneously. 2018-03-04 16:24:06 +01:00
Kare Morstol 78e7e5117e "run" - read all of standard output before waiting to finish.
Prevents hanging when standard output is larger than 64KB.
2018-03-04 16:24:06 +01:00
Kare Morstol 2719f55162 Add AsyncCommand.isRunning.
Implement strangely missing stuff on Linux.
2017-04-27 23:52:28 +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 0a078a20a5 Camel case enum cases of CommandError. 2017-04-18 19:07:56 +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 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 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 755d1aa563 run() returns RunOutput instead of String. Supports || and &&. 2017-03-29 19:59:26 +02:00
Kare Morstol bcaab22767 Require encoding for FileHandle.readSome and .read. Documentation. 2017-03-01 18:25:58 +01:00
Kare Morstol fa70e419dd Enable building for iOS. Just the Stream part. So FileSmith can use it.
The rest cannot build on iOS because it uses Process.
Move the Stream files into its own directory.
2017-02-28 01:45:24 +01:00
Kare Morstol 7204dbdb3a @discardableResult declared on a function returning Void is unnecessary. 2017-02-21 22:11:54 +01:00
Kare Morstol 62780a880a String(contentsOfFile:) not implemented on Linux, use String(contentsOfFile: encoding:) instead. 2017-01-31 00:41:29 +01:00
Kare Morstol 43a726bbba Fix testOpenForOverWritingCreatesIntermediateDirectory. 2017-01-30 20:37:13 +01:00
Kare Morstol 11b979c690 Fix AssertNoThrow silencing test failures. Cleanup test helping code. 2017-01-30 20:27:12 +01:00
Miguel Angel Quinones Garcia 93b2b36d68 Fix intermediate directories not created (#32)
* Fix intermediate directories not created

If the destination path contains nonexisting directories, the function would fail where otherwise it is expected to create all directories in the path.

* Add test for creation with intermediate directories
2017-01-30 20:13:49 +01:00
Kare Morstol ce44afe306 Turn WriteableStream and ReadableStream into protocols.
* Remove WriteableStream.writeln, use .print instead.
* Work around compiler crash on Linux.
2017-01-09 17:43:53 +01:00
kareman eea3cd2d61 Simplify WriteableStream.print 2016-11-01 21:46:46 +01:00
kareman 6acfe7f870 Add WriteableStream.print 2016-11-01 21:25:14 +01:00
kareman 221c9892bc Replace OSX with macOS 2016-11-01 20:37:47 +01:00
kareman 8ce6100286 Add FileHandle.nullDev, cross-platformise some unit test. 2016-10-16 20:51:51 +02:00
kareman 0f0ddfb9ea Add tests on Linux 2016-10-15 00:06:05 +02:00
kareman ef98b8da07 Get it to build on Linux. No tests yet. 2016-10-13 19:17:40 +02:00
Kare Morstol ed36e0228f Add ‘Tests’ suffix to test folders. As required by Swift Package Manager. 2016-10-07 22:11:37 +02:00