Skip to content

Commit 75d6d79

Browse files
committed
feat: suppot unmount root fs
1 parent dcbc88e commit 75d6d79

4 files changed

Lines changed: 21 additions & 1 deletion

File tree

packages/sumi-core/src/client/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,14 @@ export class ClientApp extends BasicClientApp {
207207
]);
208208
}
209209
}
210+
211+
unmountRootFS() {
212+
const serverApp: IServerApp = this.injector.get(IServerApp);
213+
if (serverApp) {
214+
serverApp.unmountRootFS();
215+
}
216+
}
217+
210218
async dispose() {
211219
super.dispose();
212220
this.disposer.dispose();

packages/sumi-core/src/common/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const IServerApp = Symbol('IServerApp');
1919

2020
export interface IServerApp {
2121
start(): Promise<void>;
22+
unmountRootFS(): void;
2223
rootFS: RootFS;
2324
}
2425

packages/sumi-core/src/server/core/app.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { RawMessageIO } from '@opensumi/ide-connection/lib/common/rpc/message-io
3131
import { rawSerializer } from '@opensumi/ide-connection/lib/common/serializer/raw';
3232

3333
import { IServerApp, HOME_ROOT } from '../../common';
34-
import { initializeRootFileSystem, initializeHomeFileSystem } from './filesystem';
34+
import { initializeRootFileSystem, initializeHomeFileSystem, unmountRootFS } from './filesystem';
3535
import { fsExtra as fse } from '../node';
3636
import { WORKSPACE_ROOT, STORAGE_DIR } from '../../common/constant';
3737
import { RootFS, RuntimeConfig } from '../../common/types';
@@ -238,6 +238,10 @@ export class ServerApp implements IServerApp {
238238
await this.startContribution();
239239
}
240240

241+
unmountRootFS(): void {
242+
unmountRootFS();
243+
}
244+
241245
dispose() {
242246
this.disposeCollection.dispose();
243247
}

packages/sumi-core/src/server/core/filesystem.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ export const initializeRootFileSystem = async () => {
2121
return mountfs;
2222
};
2323

24+
export const unmountRootFS = () => {
25+
if (mountfs) {
26+
// mountfs
27+
mountfs = null;
28+
}
29+
}
30+
2431
export const initializeHomeFileSystem = async (rootFS: RootFS, scenario?: string | null) => {
2532
try {
2633
let homefs: FileSystem | null = null;

0 commit comments

Comments
 (0)