Skip to content

Commit 93a2da3

Browse files
save file
1 parent 4170011 commit 93a2da3

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

utils/misc/nodejs-terminal/html/snippet-nodejs/v1.0/snippet-nodejs-v1.0.html

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,26 +147,34 @@
147147

148148
btn.run = async function(){
149149

150-
var js = editor.get();
150+
var js = editor.get();
151151
await webcontainer.fs.writeFile(tmpfile,js);
152152

153+
if(!chk.persist.checked){
154+
term.clear();
155+
}
156+
153157
var cmdline = `node ${tmpfile2}`;
154158
var args = cmdline.split(' ');
155159
var cmd = args.shift();
156160
process = await webcontainer.spawn(cmd,args);//,{cwd,output:true});
157161

158162
var stream = new WritableStream({write(data){
159163

160-
console.log(data);
161164
term.log(data);
165+
if(chk.echo.checked){
166+
console.log(data);
167+
}
162168

163169
}});
164170
process.output.pipeTo(stream)
165171

166172
var code = await process.exit;
167173

168-
console.log('process exited :',code);
169174
term.log('process exited :',code);
175+
if(chk.echo.checked){
176+
console.log('process exited :',code);
177+
}
170178

171179
}//run
172180

0 commit comments

Comments
 (0)