mirror of
https://github.com/HeyPuter/puter.git
synced 2025-02-02 14:18:43 +08:00
fix: app close issue in phoenix
This commit is contained in:
parent
b30de5bf78
commit
38adb5741b
@ -2522,6 +2522,8 @@ window.report_app_launched = (instance_id, { uses_sdk = true }) => {
|
||||
};
|
||||
|
||||
// Run any callbacks to say that the app has closed
|
||||
// ref(./services/ExecService.js): this is called from ExecService.js on
|
||||
// close if the app does not use puter.js
|
||||
window.report_app_closed = (instance_id, status_code) => {
|
||||
const el_window = window.window_for_app_instance(instance_id);
|
||||
|
||||
|
@ -79,6 +79,12 @@ export class ExecService extends Service {
|
||||
// We also have to report an extra close event because the real one was sent already
|
||||
window.report_app_closed(child_process.uuid);
|
||||
}
|
||||
|
||||
process.references.iframe.contentWindow.postMessage({
|
||||
msg: 'appClosed',
|
||||
appInstanceID: connection.forward.uuid,
|
||||
statusCode: 0,
|
||||
});
|
||||
});
|
||||
|
||||
return {
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
import { Exit } from '../coreutils/coreutil_lib/exit.js';
|
||||
import { signals } from '../../ansi-shell/signals.js';
|
||||
import { TeePromise } from '../../promise.js';
|
||||
|
||||
const BUILT_IN_APPS = [
|
||||
'explorer',
|
||||
@ -72,6 +73,10 @@ export class PuterAppCommandProvider {
|
||||
ctx.shell.addEventListener('signal.window-resize', resize_listener);
|
||||
|
||||
// Wait for app to close.
|
||||
// console.log('waiting for app to close (phoenix)', window, {
|
||||
// child_appid: child.targetAppInstanceID,
|
||||
// phoen_appid: puter.appInstanceID,
|
||||
// });
|
||||
const app_close_promise = new Promise((resolve, reject) => {
|
||||
child.on('close', (data) => {
|
||||
if ((data.statusCode ?? 0) != 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user