mirror of
https://github.com/HeyPuter/puter.git
synced 2025-01-23 22:40:20 +08:00
Fix pipes
This commit is contained in:
parent
c3654ab148
commit
3f249fcc89
@ -61,9 +61,7 @@ export class Coupler {
|
|||||||
console.log('result?', which, result);
|
console.log('result?', which, result);
|
||||||
const { value, done } = result;
|
const { value, done } = result;
|
||||||
if ( done ) {
|
if ( done ) {
|
||||||
if ( which === 'closed' ) {
|
|
||||||
cancel();
|
cancel();
|
||||||
}
|
|
||||||
this.source = null;
|
this.source = null;
|
||||||
this.target = null;
|
this.target = null;
|
||||||
this.active = false;
|
this.active = false;
|
||||||
|
@ -187,10 +187,6 @@ export class PreparedCommand {
|
|||||||
in_ = new MemReader(response);
|
in_ = new MemReader(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
const internal_input_pipe = new Pipe();
|
|
||||||
const valve = new Coupler(in_, internal_input_pipe.in);
|
|
||||||
in_ = internal_input_pipe.out;
|
|
||||||
|
|
||||||
// simple naive implementation for now
|
// simple naive implementation for now
|
||||||
const sig = {
|
const sig = {
|
||||||
listeners_: [],
|
listeners_: [],
|
||||||
@ -288,7 +284,6 @@ export class PreparedCommand {
|
|||||||
console.log(`awaiting execute for ${command.name}`)
|
console.log(`awaiting execute for ${command.name}`)
|
||||||
await execute(ctx);
|
await execute(ctx);
|
||||||
console.log(`DONE execute for ${command.name}`)
|
console.log(`DONE execute for ${command.name}`)
|
||||||
valve.close();
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if ( e instanceof Exit ) {
|
if ( e instanceof Exit ) {
|
||||||
exit_code = e.code;
|
exit_code = e.code;
|
||||||
@ -353,6 +348,11 @@ export class Pipeline {
|
|||||||
let nextIn = ctx.externs.in;
|
let nextIn = ctx.externs.in;
|
||||||
let lastPipe = null;
|
let lastPipe = null;
|
||||||
|
|
||||||
|
// Create valve to close input pipe when done
|
||||||
|
const pipeline_input_pipe = new Pipe();
|
||||||
|
const valve = new Coupler(nextIn, pipeline_input_pipe.in);
|
||||||
|
nextIn = pipeline_input_pipe.out;
|
||||||
|
|
||||||
// TOOD: this will eventually defer piping of certain
|
// TOOD: this will eventually defer piping of certain
|
||||||
// sub-pipelines to the Puter Shell.
|
// sub-pipelines to the Puter Shell.
|
||||||
|
|
||||||
@ -392,5 +392,7 @@ export class Pipeline {
|
|||||||
console.log('|AWAIT COUPLER');
|
console.log('|AWAIT COUPLER');
|
||||||
await coupler.isDone;
|
await coupler.isDone;
|
||||||
console.log('|DONE AWAIT COUPLER');
|
console.log('|DONE AWAIT COUPLER');
|
||||||
|
|
||||||
|
valve.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user