Skip to content

Commit

Permalink
Merge pull request #15 from vapor/terminal-fix
Browse files Browse the repository at this point in the history
Terminal fix
  • Loading branch information
tanner0101 authored Sep 7, 2016
2 parents 93ea910 + 090ed92 commit ef60f09
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions Sources/Console/Console/ConsoleError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public enum ConsoleError: Swift.Error {
case argumentNotFound
case commandNotFound(String)
case cancelled
case spawnProcess
case execute(Int)
case backgroundExecute(Int, String)
case fileOrDirectoryNotFound
Expand Down
9 changes: 8 additions & 1 deletion Sources/Console/Terminal/Terminal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,14 @@ public class Terminal: ConsoleProtocol {
}

_pids.append(pid)
let result = posix_spawnp(pid, argv[0], &fileActions, nil, argv + [nil], env + [nil])
let spawned = posix_spawnp(pid, argv[0], &fileActions, nil, argv + [nil], env + [nil])
if spawned != 0 {
throw ConsoleError.spawnProcess
}

var result: Int32 = 0
_ = waitpid(pid.pointee, &result, 0)
result = result / 256

waitpid(pid.pointee, nil, 0)

Expand Down

0 comments on commit ef60f09

Please sign in to comment.