Skip to content

Commit

Permalink
* Simplify export cell example to avoid drawing attention to the example
Browse files Browse the repository at this point in the history
code.
  • Loading branch information
pcuenca committed Apr 22, 2019
1 parent 036263f commit 8c87af5
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,10 @@ Mark the cells you wish to export with a `//export` comment in the first line of

```Swift
//export
@discardableResult
public func shellCommand(_ launchPath: String, _ arguments: [String]) -> String

public func notebookFunction()
{
let task = Process()
task.executableURL = URL(fileURLWithPath: launchPath)
task.arguments = arguments

let pipe = Pipe()
task.standardOutput = pipe
do {
try task.run()
} catch {
print("Unexpected error: \(error).")
}

let data = pipe.fileHandleForReading.readDataToEndOfFile()
return String(data: data, encoding: String.Encoding.utf8) ?? ""
/* Code */
}
```

Expand Down

0 comments on commit 8c87af5

Please sign in to comment.