Skip to content

Commit

Permalink
Fix bug with terminal command calling
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryAstafyev committed Sep 8, 2023
1 parent bb5c7c8 commit 283f990
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 9 deletions.
3 changes: 2 additions & 1 deletion application/client/src/app/service/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,11 @@ export class Service extends Implementation {
observe,
api: {
finish: (observe: Observe): Promise<void> => {
return new Promise((_, failed) => {
return new Promise((success, failed) => {
this.initialize()
.observe(observe, session)
.then((session) => {
success();
api?.close();
resolve(session);
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ export class SetupBase
};

protected setup(): void {
this.cmdInputRef.set(this.state.configuration.configuration.command);
this.cwdInputRef.set(this.state.configuration.configuration.cwd);
this.cmdInputRef !== undefined &&
this.cmdInputRef.set(this.state.configuration.configuration.command);
this.cwdInputRef !== undefined &&
this.cwdInputRef.set(this.state.configuration.configuration.cwd);
this.action.setDisabled(this.configuration.validate() instanceof Error);
if (this.state.configuration.configuration.cwd.trim() !== '') {
return;
Expand Down Expand Up @@ -141,15 +143,14 @@ export class SetupBase
this.detectChanges();
}),
this.action.subjects.get().applied.subscribe(() => {
this._inputs.cmd.recent.emit(undefined);
this._inputs.cmd.recent.emit(this.state.configuration.configuration.command);
this.state.configuration.configuration.cwd.trim() !== '' &&
this.ilc()
.services.system.bridge.cwd()
.set(undefined, this.state.configuration.configuration.cwd)
.catch((err: Error) => {
this.log().error(`Fail to set cwd path: ${err.message}`);
});
this.setup();
}),
);
this.action.setDisabled(this.configuration.validate() instanceof Error);
Expand Down
1 change: 1 addition & 0 deletions application/client/src/app/ui/tabs/observe/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export class State extends Subscriber {
if (this.action.disabled) {
return;
}
this.action.applied();
this.ref.api.finish(this.observe).catch((err: Error) => {
this.ref
.ilc()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,13 @@ export class List extends ListBase<State, Provider> implements AfterContentInit
new Factroy.Stream().asText().process(this.initial.configuration).get(),
)
.then(() => {
this.initial.overwrite(Configuration.initial());
const cloned = this.initial.sterilized();
this.action.applied();
this.initial.overwrite({
command: '',
cwd: cloned.cwd,
envs: cloned.envs,
});
})
.catch((err: Error) => {
this.log().error(`Fail to apply connection to Process: ${err.message}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ export class List extends ListBase<State, Provider> implements AfterContentInit
new Factroy.Stream().asText().serial(this.initial.configuration).get(),
)
.then(() => {
this.initial.overwrite(Configuration.initial());
this.action.applied();
this.initial.overwrite(Configuration.initial());
})
.catch((err: Error) => {
this.log().error(`Fail to apply connection to Serial: ${err.message}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ export class List extends ListBase<State, Provider> implements AfterContentInit
new Factroy.Stream().asDlt().tcp(this.initial.configuration).get(),
)
.then(() => {
this.initial.overwrite(Configuration.initial());
this.action.applied();
this.initial.overwrite(Configuration.initial());
})
.catch((err: Error) => {
this.log().error(`Fail to apply connection to TCP: ${err.message}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ export class List extends ListBase<State, Provider> implements AfterContentInit
new Factroy.Stream().asDlt().udp(this.initial.configuration).get(),
)
.then(() => {
this.initial.overwrite(Configuration.initial());
this.action.applied();
this.initial.overwrite(Configuration.initial());
})
.catch((err: Error) => {
this.log().error(`Fail to apply connection to UDP: ${err.message}`);
Expand Down

0 comments on commit 283f990

Please sign in to comment.