-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Send stdout/stderr from WasmRunner to dev server without decoding as …
…UTF-8 (#471) * Enable WasmRunner to handle stdout as raw binary * catch other errors * move devDeps * use browser exception handling * comment out
- Loading branch information
Showing
13 changed files
with
224 additions
and
69 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.DS_Store | ||
/.build | ||
/Packages | ||
xcuserdata/ | ||
DerivedData/ | ||
.swiftpm | ||
.netrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// swift-tools-version: 5.9 | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "DevServerTestApp", | ||
products: [ | ||
.executable(name: "app", targets: ["app"]) | ||
], | ||
dependencies: [ | ||
.package(path: "../../.."), | ||
.package(url: "https://github.com/swiftwasm/JavaScriptKit", from: "0.19.2") | ||
], | ||
targets: [ | ||
.executableTarget( | ||
name: "app", | ||
dependencies: [ | ||
.product(name: "JavaScriptKit", package: "JavaScriptKit") | ||
], | ||
resources: [ | ||
.copy("style.css") | ||
] | ||
), | ||
.testTarget( | ||
name: "SimpleTests" | ||
) | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
This application serves as a working environment for experimenting with the behavior of "carton". | ||
Since it is not used by automated tests, it can be easily modified. | ||
If you want to include the behavior created here in automated tests, | ||
please separate the target application for testing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#if os(WASI) | ||
import WASILibc | ||
typealias FILEPointer = OpaquePointer | ||
#else | ||
import Darwin | ||
typealias FILEPointer = UnsafeMutablePointer<FILE> | ||
#endif | ||
|
||
import JavaScriptKit | ||
|
||
func fputs(_ string: String, file: FILEPointer) { | ||
_ = string.withCString { (cstr) in | ||
fputs(cstr, file) | ||
} | ||
} | ||
|
||
fputs("hello stdout\n", file: stdout) | ||
fputs("hello stderr\n", file: stderr) | ||
|
||
//fatalError("hello fatalError") | ||
|
||
let document = JSObject.global.document | ||
|
||
let button = document.createElement("button") | ||
_ = button.appendChild( | ||
document.createTextNode("click to crash") | ||
) | ||
|
||
_ = button.addEventListener("click", JSClosure { (e) in | ||
fatalError("crash") | ||
}) | ||
|
||
_ = document.body.appendChild(button) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
* { | ||
margin: 0; | ||
padding: 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import XCTest | ||
|
||
final class BasicTests: XCTestCase { | ||
func testAdd() { | ||
XCTAssertEqual(1 + 1, 2) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.