Skip to content

Commit 67465a3

Browse files
authored
Merge pull request #10 from QiuZhiFei/dev
fix: error output
2 parents 44e6aac + c14a750 commit 67465a3

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

Examples/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Commands.Bash.run("ls /bin/ls").log()
2323
Commands.Ruby.run("require 'base64'; puts Base64.encode64('qiuzhifei')").log()
2424

2525
// Python
26-
Commands.Python.run("import base64; print(base64.b64encode('qiuzhifei').decode('ascii'))").log()
26+
Commands.Python.run("import base64; print(base64.b64encode(b'qiuzhifei').decode('ascii'))").log()
2727

2828
// Custom
2929
let node = Commands.Alias("node", dashc: "-e")

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ let result = Commands.Task.run("python main.py")
3737
```
3838
Execute python commands.
3939
```swift
40-
let result = Commands.Task.run("python -c import base64; print(base64.b64encode('qiuzhifei').decode('ascii'))")
40+
let result = Commands.Task.run("python -c import base64; print(base64.b64encode(b'qiuzhifei').decode('ascii'))")
4141
```
4242
Or
4343
```swift
44-
let result = Commands.Python.run("import base64; print(base64.b64encode('qiuzhifei').decode('ascii'))")
44+
let result = Commands.Python.run("import base64; print(base64.b64encode(b'qiuzhifei').decode('ascii'))")
4545
```
4646

4747
### Ruby

README_cn.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ let result = Commands.Task.run("python main.py")
3737
```
3838
Execute python commands.
3939
```swift
40-
let result = Commands.Task.run("python -c import base64; print(base64.b64encode('qiuzhifei').decode('ascii'))")
40+
let result = Commands.Task.run("python -c import base64; print(base64.b64encode(b'qiuzhifei').decode('ascii'))")
4141
```
4242
Or
4343
```swift
44-
let result = Commands.Python.run("import base64; print(base64.b64encode('qiuzhifei').decode('ascii'))")
44+
let result = Commands.Python.run("import base64; print(base64.b64encode(b'qiuzhifei').decode('ascii'))")
4545
```
4646

4747
### Ruby

Sources/Commands/CommandsTask.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public extension Commands.Task {
3636
}
3737

3838
let response = Commands.Response(statusCode: process.terminationStatus,
39-
output: errorActual,
39+
output: outputActual,
4040
errorOutput: errorActual)
4141
return Commands.Result.Failure(request, response: response)
4242
} catch let error {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
import base64;
2-
print(base64.b64encode('qiuzhifei').decode('ascii'));
2+
print(base64.b64encode(b'qiuzhifei').decode('ascii'));

Tests/CommandsTests/swift_commandsTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ final class swift_commandsTests: XCTestCase {
1515

1616
let lsResult = Commands.Bash.run("ls \(dir)")
1717
XCTAssert(lsResult.isFailure)
18-
XCTAssert(lsResult.output.contains("No such file or directory"))
18+
XCTAssert(lsResult.errorOutput.contains("No such file or directory"))
1919
}
2020

2121
func testCommandsRuby() throws {
@@ -32,7 +32,7 @@ final class swift_commandsTests: XCTestCase {
3232
func testCommandsPython() throws {
3333
let python = Commands.Python
3434

35-
let base64Result = python.run("import base64; print(base64.b64encode('qiuzhifei').decode('ascii'))")
35+
let base64Result = python.run("import base64; print(base64.b64encode(b'qiuzhifei').decode('ascii'))")
3636
XCTAssert(base64Result.isSuccess)
3737
XCTAssert(base64Result.output == "qiuzhifei".data(using: .utf8)!.base64EncodedString())
3838
XCTAssert(base64Result.output == "cWl1emhpZmVp")
@@ -90,8 +90,8 @@ final class swift_commandsTests: XCTestCase {
9090

9191
// python
9292
XCTAssertEqual(
93-
Commands.Python.run("import base64; print(base64.b64encode('qiuzhifei').decode('ascii'))"),
94-
Commands.Task.run("python -c import base64; print(base64.b64encode('qiuzhifei').decode('ascii'))")
93+
Commands.Python.run("import base64; print(base64.b64encode(b'qiuzhifei').decode('ascii'))"),
94+
Commands.Task.run("python -c import base64; print(base64.b64encode(b'qiuzhifei').decode('ascii'))")
9595
)
9696

9797
// node

0 commit comments

Comments
 (0)