New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build 164: Closing and re-opening a-Shell -> black screen #235
Comments
If I call |
Looking at the debugging console, I see that this line: a-shell/a-Shell/SceneDelegate.swift Line 1941 in 9158a9f
results in an error: "JavaScript execution returned a result of an unsupported type". There is a strong probability that the two problems are connected. |
Same here. (a-Shell 1.7.3 (164), iPadOS 14.7 DB 2) In my case, opening a new window in Split View fixes the issue temporarily. (iPadOS only) |
I've traced it to |
Build 165 is out on TestFlight. It seems to solve the issue on my setup. |
I'm still experiencing the issue... |
It seems to works when running from Xcode but not when running from TestFlight. This might be difficult to debug. |
I've found that the following change would fix the problem, so I think it is something like a race condition. diff --git a/script.js b/script.js
index e3c3f5ac..c288568c 100644
--- a/script.js
+++ b/script.js
@@ -990,7 +990,7 @@ function setupHterm() {
window.onload = function() {
lib.init();
- setupHterm();
+ setTimeout(() => setupHterm(), 3000);
};
// Modifications and additions to hterm_all.js: |
I tried On the other hand, this modification will fix the issue: diff --git a/script.js b/script.js
index e3c3f5ac..5cd06a27 100644
--- a/script.js
+++ b/script.js
@@ -337,6 +337,7 @@ function updateAutocompleteMenu(io, cursorPosition) {
}
function setupHterm() {
+ setTimeout(() => {
const term = new hterm.Terminal();
// Default monospaced fonts installed: Menlo and Courier.
term.prefs_.set('cursor-shape', 'BLOCK');
@@ -986,6 +987,7 @@ function setupHterm() {
window.commandRunning = window.commandToExecute;
window.commandToExecute = "";
}
+ }, 3000);
}
window.onload = function() { But this one won't: diff --git a/script.js b/script.js
index e3c3f5ac..40f8c3c4 100644
--- a/script.js
+++ b/script.js
@@ -338,6 +338,7 @@ function updateAutocompleteMenu(io, cursorPosition) {
function setupHterm() {
const term = new hterm.Terminal();
+ setTimeout(() => {
// Default monospaced fonts installed: Menlo and Courier.
term.prefs_.set('cursor-shape', 'BLOCK');
term.prefs_.set('font-family', window.fontFamily);
@@ -986,6 +987,7 @@ function setupHterm() {
window.commandRunning = window.commandToExecute;
window.commandToExecute = "";
}
+ }, 3000);
}
window.onload = function() { Therefore, the timing at which |
The hterm documentation now recommends:
I'm going to try with that. |
@holzschu I already tried that. This issue seems to be caused by another reason. |
@kkk669 thanks for the warning. I'll try with the timeout then. But I'm curious: how do you manage to reproduce the issue when you're compiling the app yourself? For me it always works when installed from Xcode. |
@holzschu I reproduce the issue by the following steps.
|
Thanks. With your instructions, I am able to reproduce the issue. I'd like to avoid the timeout, as it might break later. var interval = setInterval(function() {
if (hterm.windowType) {
clearInterval(interval);
setupHterm();
}
}, 200); Now that works (as in, I get the prompt), but the session setup has not been done, so the colors and text are lost. But I feel I'm getting there. |
Me too. I had used it to isolate the causes.
|
I was thinking that it was possible that |
Are you referring to this line? When I inserted a delay to there (inside or outside of the closure), it didn't give any effects. |
So the signs are pointing towards |
With |
Yes. |
Thanks. if (!hterm.Terminal) { ... } and it was triggered. It seems that sometimes, |
I think part of the issues may be caused by calling hterm.Terminal.IO.prototype.print =
hterm.Terminal.IO.prototype.writeUTF16 = function(string) {
// If another process has the foreground IO, buffer new data sent to this IO
// (since it's in the background). When we're made the foreground IO again,
// we'll flush everything.
// iOS addition: don't print until accessibilityReader_ is available. buffer strings until then.
if ((this.terminal_.io != this) || (window.term_.accessibilityReader_ == null)) {
this.buffered_ += string;
return;
}
this.terminal_.interpret(string);
// iOS: keep a copy of everything that has been sent to the screen,
// to restore terminal status later and resize.
if (this.terminal_.isPrimaryScreen()) {
window.printedContent += string;
}
}; |
Inspired by your idea, I've added window.onerror = (msg, url, line, column, error) => {
const message = {
message: msg,
url: url,
line: line,
column: column,
error: JSON.stringify(error)
}
if (window.webkit) {
window.webkit.messageHandlers.aShell.postMessage('JS Error:' + msg + ' ' + error.stack);
} else {
console.log("Error:", message);
}
}; |
I think it's fixed in build 166, but I'll wait for your tests. |
Yes! It's fixed! |
Summary
Terminal settings
config -s 16
, I think)config -b black
)Thanks again for working on this!
The text was updated successfully, but these errors were encountered: