Skip to content

GPT tells me these should all wait forever, not complete and exit the process #45

@wysisoft

Description

@wysisoft

I am trying to run a process forever I can communicate with using stdio, but they all seem to exit immediately. I looked at the source code and I think I am taking the wrong path through nodepod, I want to go into executeNodeBinary where this all behaves well, but i'm instead going through sandbox.eval

let proc = await nodepod.spawn('node -e "' + debugger; require('fs').readSync(0, Buffer.alloc(1), 0, 1, null); debugger;.replaceAll('\n', '') + '"');
await proc.completion;
debugger;

proc = await nodepod.spawn('node -e "' + debugger; setInterval(() => {}, 1 << 30); debugger;.replaceAll('\n', '') + '"');
await proc.completion;
debugger;

proc = await nodepod.spawn('node -e "' + `
debugger;
process.stdin.resume();
process.stdin.setEncoding('utf8');

let buffer = '';
process.stdin.on('data', (chunk) => {
buffer += chunk;
const lines = buffer.split('\n');
buffer = lines.pop();
for (const line of lines) {
var v = 0;
}
});
debugger;
var v = 0;
`.replaceAll('\n', '') + '"');
await proc.completion;
debugger;

proc = await nodepod.spawn('node -e "' + debugger; await new Promise(resolve => setTimeout(resolve, 10000)); debugger; var v = 0;.replaceAll('\n', '') + '"');
await proc.completion;
debugger;

proc = await nodepod.spawn('node -e "' + debugger; setInterval(() => { console.log('still alive', Date.now()); }, 1000); debugger; var v = 0;.replaceAll('\n', '') + '"');
await proc.completion;
debugger;

proc = await nodepod.spawn('node -e "' + `
debugger;
process.stdin.resume();

setInterval(() => {
process.stdout.write('.');
}, 1000);
debugger;
var v = 0;
`.replaceAll('\n', '') + '"');
await proc.completion;
debugger;

proc = await nodepod.spawn('node -e "' + debugger; setInterval(() => { require('crypto').randomBytes(16); }, 1000); debugger; var v = 0;.replaceAll('\n', '') + '"');
await proc.completion;
debugger;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions